Article 92 - How to Convert Hex to Decimal?

Converting a hexadecimal representation of an integer to the equivalent binary form is really easy.

Example

A common hexadecimal integer is often denoted as 0x12345678.

The equivalent binary form is 0001001001101000101011001111000.

Let's delimit the binary form for every four digits to make it easier to visualize. We have 0001-0010-0011-0100-0101-0110-0111-1000.

A closer inspection of the delimited binary representation suggests that each four digits of the binary representation matches each digit in the hexadecimal representation.

For example, the first digit of the hexadecimal representation is a 1. What is the value of the first four digits in the binary respresentation? It is a 1 as well, as 0001 represents 1 in base 10.

Can we try this for the second, or third digit in the hexadecimal representation? Yes, since, binary 0010 represents 2 and binary 0011 represents 3.

As an exercise, the reader is encouraged to try this for all possible values of a hex digit. Notice that the greatest four digit binary number is 15, which is represented as 1111. Furthermore, 15 is represented as F in hexadecimal, also the greatest single digit hexadecimal value.

Comments (0)

Post a comment

  • Name:
  • Post:
  • Challenge:

Register or login to post comments easier.


Vantasy World Copyright 2011 - 2017. Vantasy World is a project developed by Vantasy Online. Privacy Policy.