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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Binary, Octal, and Hex" Watch "Binary, Octal, and Hex" New topic
Author

Binary, Octal, and Hex

Bartholemu Smith
Ranch Hand

Joined: May 08, 2001
Posts: 317
I was wondering if there is a easy way to go between all the different bases. From Hex to Octal and binary? This is where I can get confused. Any Quick tricks? Binary to Decimal is easy and vice-versa. Just the others seems confusing.
Thanks
Faisal
------------------
Faisal Dosani
B.Sc, AIT
Bala Arul
Greenhorn

Joined: Feb 09, 2001
Posts: 29
Hi Faisal,
1) Hex to Binary
Convert every digit into 4 bit Binary.
e.g) A6 = 1010 0110
2) Binary to Hex
Group by 4 bits from right to left, then convert each group to Hex equivalent.
e.g) 101011 = 0010 1011 = 2B
3) Oct to Bin and Bin to Oct would have the procedure as above, but with group of 3 bits instead of 4 bits.
4) For Oct to Hex and Hex to Oct, there need to be an intermediate binary conversion. i.e, Oct to Bin to Hex and Hex to Bin to Oct.
Hope that helps.
B Arul.

[This message has been edited by Bala Arul (edited May 08, 2001).]
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Faisal,
I've got some notes posted on Binary/Octal/Decimal/Hex conversions at http://www.janeg.ca/scjp/oper/binhex.html
Hope they help.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Bartholemu Smith
Ranch Hand

Joined: May 08, 2001
Posts: 317
Thanks Jane, that really helps.
This place is way to friendly
Thanks again
Faisal
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Your welcome Faisal.

This place is way to friendly

Well ... that is our slogan

------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Binary, Octal, and Hex