Binary to Hexadecimal Conversion
To convert a value from binary to hexadecimal, you first add a number of 0's to the left of the most significant bit of the binary number, so the
number of bits of the new binary number is a multiple of 4. Then, you simply translate each 4-bit binary nibble to its hexadecimal digit equivalent.
For example, to convert to hex the binary number 1100100011, we add two zeros to the left of the most significant bit:
0011 0010 0011.
Then we translate 0011 0010 0011 to 0x323, as 0011 is 0x3 and 0010 is 0x2.