It's used to represent binary numbers in a more human-readable format.
Understanding Hexadecimal
Place Value: Each position represents a power of 16 (ones, sixteens, 256s, 4096s, etc.).
Symbols: Uses 16 symbols: 0-9 and A-F.
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Prefix: 0x is commonly used to indicate a hexadecimal number (e.g., 0x1A).
Counting: After 0xF comes 0x10 (decimal 16), then 0x11, 0x12, etc.
Table 1-5: Hexadecimal Symbols
Hexadecimal
Decimal
Binary (4-bit)
0
0
0000
1
1
0001
2
2
0010
3
3
0011
4
4
0100
5
5
0101
6
6
0110
7
7
0111
8
8
1000
9
9
1001
A
10
1010
B
11
1011
C
12
1100
D
13
1101
E
14
1110
F
15
1111
Converting Hexadecimal to Decimal
Multiply the decimal equivalent of each hex digit by its corresponding power of 16.
Example: 0x1A5
5 is in the ones place: 5 * 1 = 5
A (10) is in the sixteens place: 10 * 16 = 160
1 is in the 256s place: 1 * 256 = 256
Total: 5 + 160 + 256 = 421
Why Use Hexadecimal?
Readability: Easier to read and write than long binary sequences.
Conversion to Binary: Straightforward conversion between hexadecimal and binary.
Relationship Between Hexadecimal and Binary
Each hexadecimal symbol represents 4 bits (a nibble).
A byte (8 bits) can be represented by two hexadecimal symbols.
A 16-bit number can be represented by four hex symbols.
A 32-bit number can be represented by eight hex symbols.
Converting Binary to Hexadecimal
Group the binary number into groups of 4 bits, starting from the right.
Convert each group of 4 bits into its corresponding hexadecimal symbol.
Converting Hexadecimal to Binary
Convert each hexadecimal digit to its 4-bit binary equivalent.
Concatenate the binary equivalents.
Exercises
EXERCISE 1-4: BINARY TO HEXADECIMAL
Convert these numbers, represented in binary, to their hexadecimal equivalents. Don’t convert to decimal if you can help it! The goal is to move directly from binary to hexadecimal.
10 (binary) = ______ (hexadecimal)
11110000 (binary) = ______ (hexadecimal)
EXERCISE 1-5: HEXADECIMAL TO BINARY
Convert these numbers, represented in hexadecimal, to their binary equivalents. Don’t convert to decimal if you can help it! The goal is to move directly from hexadecimal to binary.
1A (hexadecimal) = _____ (binary)
C3A0 (hexadecimal) = ______ (binary)
0 Comments
Author
Write something about yourself. No need to be fancy, just an overview.