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.
SCJP 1.4<br />SCWCD 1.4
Joined: Jul 02, 2002
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 ]
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>