Author
how do i declare an int in binary format?
Josh Forrest
Greenhorn
Joined: Oct 08, 2002
Posts: 7
posted Oct 08, 2002 10:45:00
0
how do i declare an int in binary format?
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted Oct 08, 2002 10:55:00
0
What do you want to do? Load it with a binary value or print out the result as a binary value?
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Josh Forrest
Greenhorn
Joined: Oct 08, 2002
Posts: 7
posted Oct 08, 2002 12:07:00
0
i would like to take a binary value and print out it's decimal representation. thanks.
Joe Meade
Greenhorn
Joined: Feb 27, 2002
Posts: 5
The Integer class has a couple of static methods that handle what you are trying to do: HTH, Joe
B Stapleton
Greenhorn
Joined: Sep 07, 2010
Posts: 3
Update: As of Java 7, you can declare binary numbers with this syntax:
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
To avoid any confusion, that syntax in no way changes how the int is stored or how the int is declared. All that notation does is to allow numeric littorals to be expressed as binary number. No mre and no less.
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
subject: how do i declare an int in binary format?