views:

43

answers:

1
+3  A: 

The conversion between binary and either octal or hex is even easier than decimal. Just break the binary digits up into groups of 3 or 4 (depending on oct or hex), then convert each group to a digit. (If you don't have a multiple of 3 or 4 binary digits, just left-pad the number with zeros.)

Example:

111101111010 binary
1111 0111 1010
   F    7    A
           F7A hex

111101111010
111 101 111 010
  7   5   7   2
           7572 oct

Converting back is just the opposite. Each digit in octal or hex gets converted directly to either 3 or 4 binary digits.

Bill the Lizard
Excellent. Thanks a lot.