aspose file tools*
The moose likes Beginning Java and the fly likes Literal for binary number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Literal for binary number" Watch "Literal for binary number" New topic
Author

Literal for binary number

Gustavo Adolpho Bonesso
Ranch Hand

Joined: May 11, 2002
Posts: 103
Hi !
There is a literal form to represent a binary number, as we do have with hexadecimal numbers (0xA34F) ? For example, how can i initialize a byte variable with a binary number ?
byte x = 0101011;
Thanks !


Gustavo Adolpho Bonesso<br />SCJP1.4
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
byte b = Byte.parseByte("0101011", 2);


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Literal for binary number