Binary is a numeral system that is 2 based, i.e., it uses only 0s and 1s, to denote a value. Because binary is 2
based, each successive bit is twice the value of the preceding bit, read from right to left. This is illustrated in
Appendix
A. A 0 denotes that the bit does not carry a value and a 1 denotes
that the bit does carry a value. When binary value has more than one
1, as in 000001001 the decimal values for the 1s are added to produce
the decimal value. In this example 000000001 is 1 and 000001000 is 8.
Therefore the decimal value for 000001001 is 9 (8+1). The maximum binary
value for an octet would contain all 1s, as in 111101111, and would
have a decimal value 255 (128+64+32+16+8+4+2+1), as illustrated in Figure
3.1.
| Binary Code |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
| Decimal Value |
128 |
64 |
32 |
16 |
8 | 4 | 2 | 1 |
FIGURE 3.1: Binary Code 1111 1111
The decimal value of the binary code is the sum of decimal value of each bit. Therefore the decimal value
for a binary code of 111101111 is 128+64+32+16+8+4+2+1=255
Note: The corresponding decimal value of the binary code is calculated from
right to left and not left to right.
A 0 in the binary code indicates that the corresponding bit has no value. Figure 3.2 illustrates a byte with a
binary code of 111001101 and the value of each of its eight bits.
| Binary Code |
1 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
| Decimal Value |
128 |
64 |
32 |
16 |
8 | 4 | 2 | 1 |
FIGURE 3.2: Binary Code 1110 1101
The decimal value for this binary code is 128+64+32+0+8+4+0+1=237
Note: Each bit in the binary code that is marked with a 0 has no value.
Therefore the corresponding decimal value of these bits are also 0.