aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes converting to binary. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "converting to binary." Watch "converting to binary." New topic
Author

converting to binary.

jagadish thandra
Greenhorn

Joined: Jul 09, 2003
Posts: 2
can anybody suggest me the way which i am following to convert the numbers to binary format is right.
i am using the following method.
eg take 8 as the number which should be converted to binary format.
i am dividing it by 2 keeping the reminder right to left.again i am dividing the multiple by 2 until the multiple is 1, and keep the 1 at left side.
8 in binary format is 1000.
binary to number
In binary, each position is 2 times bigger than the position to its right:
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
1000 = 8*1+4*0+2*0+1*0=8.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
I think it is correct.. I use the same


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting to binary.