Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!

# Whats the easiest way to learn Different bases

Pavneet Kaur
Greenhorn
Posts: 1
I am looking for a easy and quick way to learn Decimal equivalent in Hex and Octal. Any ideas. What kinda question comes in 1.4 exam for this topic?

Nidhi Juneja
Greenhorn
Posts: 27
Hi Pavneet...there r 2 options which i know....
first method:
1)for hex-divide the number by 16 and keep the remainder aside.
2)repeat step 1 again and again till u get a number smaller than 16 in which case this will be the remainder.
3)change 10 to A ,11 to B and so on for the remainders.
3)now start traversing the remainders in the reverse order than they were produced.
resulting number is hex equivalent
do the same for octal conversion but this time divide by 8.
second method:
1)convert decimal in to binary
2)for hex-start from the rightmost bit and make groups of 4 bits each. write the hex eq of each group. resulting is the converted value.
3)for octal-make groups of 3 from the right.
we don't get direct questions on conversion but it important to know for fns like tohexstring,tooctalstring and for unicode characters as well...
hope it is clear.