you can calculate on the paper provided during the test. i don't know of a shortcut. but the basic idea is that the bits are grouped into groups of four, and each of those groups is represented by a hex digit, which can take the values
0000 - 0 0001 - 1 etc. 1010 - a 1011 - b etc. 1111 - f
for example, Integer.MAX_VALUE has a bit pattern of 0111.1111.1111.1111.1111.1111.1111.1111 which is 7fffffff
i'm not sure if you are serious well, i was just trying to help, and to explain the way i have handled such questions sucessfully in past exams, and i think i will also handle it like this in the SCJP exam (unless somebody comes up with a way that works better for me)
but i overread the first part of the question. i am also not sure if these kind of question can show up in the exam
decimal to hexadecimal there r 2 ways first one is to convert the decimal to binary and then binary can be converted to hexadecimal by making combinations of 4 bits each and making their equivalent hexadecimal as explained in an earlier post similarly octal equivalents can be formed by making combinations of 3 bits at a time
another way is direct conversion of integer to hexadecimal . this method shd be used if no is small (unlike the given problem where we have to find hexa of Integer.MAXIMUM) for eg to find hexa equivalent of 57 , divide 57 by 16 store the remainder and keep on dividing the quotient by 16 until it becomes 0 . the req emainders arranged gives the hexadecimal no
eg: 57/16 quo:3 remainder 9 now 3/16 quo :0 remainder :3 hence hexadecimal of 57 is 39
similarly 57 can be converted to octal by dividing by 8
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Gift giving made easy with the permaculture playing cards