Hexadecimal Notation

Hexadecimal Notation

Hexadecimal uses digits 0?9 and characters staring from ?A? to ?F? which altogether contains 16 different values. A single hexadecimal digit can be represented by 4 binary digits (Refer Table 1).

Image for postTable 1 : Decimal-Hexa-Binary

Java and C uses 0x or 0X to represent hexadecimal numbers. Characters (?A? to ?F?) in a hexadecimal number can be written either in upper case or lower case. For example, 0xa8b3d is same as 0xA8B3D.

Converting hexadecimal number to binary

Suppose we want to convert the number 0x39A7F8 to binary. This is how you do it.

Image for post

Converting binary to hexadecimal

If we are given the binary 1001101110011110110101 to convert to hexadecimal, first split the binary digits into 4 bit groups and then if the number of bits is not a multiple of 4, padded the left most group with 0s.

Image for post

1

No Responses

Write a response