Sidetrack: Numeral Systems (cont)
Conversion between binary and hexadecimal
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
|
8 | 9 | A | B | C | D | E | F |
1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
- Binary to hexadecimal
- Collect bits into groups of four starting from right to left
- "pad" out left-hand side with 0's if necessary
- Convert each group of four bits into its equivalent hexadecimal representation (given in table above)
- Hexadecimal to binary
- Reverse the previous process
- Convert each hex digit into equivalent 4-bit binary representation
|