programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# Numerical conversions in SCJP exam?

Ranch Hand
Posts: 330
• Number of slices to send:
Optional 'thank-you' note:
Hello. I'm studying for the scjp. Does anybody here know whether or not numerical conversions are included in the exam? like binary to decimal, decimal to binary, octal to hex, hex to octal, hex to binary, etc.

Ranch Hand
Posts: 1865
• Number of slices to send:
Optional 'thank-you' note:
Dennis,
The four bases, binary, octal, decimal, and hexadecimal, appear on the exam so a familiarity with all four is certainly advantageous.
Digital computers work with binary values. We humans learned how to count using our fingers so base 10, decimal, is the number system that we prefer. Unfortunately, conversions between the two number systems are not as easy as we would like. In contrast, conversions are very easy between binary and any number system with a base that is a multiple of two. Examples would be bases 4, 8, and 16.
From a human point of view, base 4 isn't a lot more readable than base 2. The next choice, base 8 (octal), is preferable because it uses nearly all of the digits that we are familiar with--0, 1, 2, 3, 4, 5, 6 and 7. Using base 8, a byte of binary data can be conveniently converted to octal just by arranging the bits as a series of three nibbles and by converting the nibbles separately to octal. The binary value, 11111111, can be written as the following 3 nibbles--11 111 111. The first nibble, 11, is represented in octal as 3. The second nibble, 111, is represented in octal as 7. The entire series of three binary nibbles are represented in octal as 377.
By moving to hexadecimal the size of the nibble can be increased to four bits. The eight bit binary value, 01100111, can be organized as two nibbles as follows--0110 0111. The first nibble is represented in hexadecimal as 6. The second nibble is represented in hex as 7. The sequence of the two nibbles is represented in hexadecimal as 67.
My web site has a short base conversion tutorial.
The Cat and Mouse Game with Bits here at the JavaRanch is also helpful.
[ March 09, 2003: Message edited by: Dan Chisholm ]

dennis zined
Ranch Hand
Posts: 330
• Number of slices to send:
Optional 'thank-you' note:
thanks Dan!

 See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad: a bit of art, as a gift, that will fit in a stocking https://gardener-gift.com