Java Reference
In-Depth Information
Place value:
10 3
10 2
10 1
10 0
Decimal number:
8427
Decimal number:
10 3
1000
10 2
100
10 1
10
10 0
1
8
8
*
*
+
+
4
4
*
*
+
+
2
2
*
*
+
+
7
7
*
*
=
=
8427
FIGURE B.1 Place values in the decimal system
Each place value is determined by the base of the number system, raised to
increasing powers as we move from right to left. In the decimal number system,
the place value of the digit furthest to the right is 10 0 , or 1. The place value of the
next digit is 10 1 , or 10. The place value of the third digit from the right is 10 2 , or
100, and so on. Figure B.1 shows how each digit in a decimal number contributes
to the value.
The binary system works the same way except that we exhaust the available
digits much sooner. We can represent 0 and 1 with a single bit, but to represent
any value higher than 1, we must use multiple bits.
The place values in binary are determined by increasing powers of the base as
we move right to left, just as they are in the decimal system. However, in binary,
the base value is 2. Therefore the place value of the bit furthest to the right is 2 0 ,
or 1. The place value of the next bit is 2 1 , or 2. The place value of the third bit
from the right is 2 2 , or 4, and so on. Figure B.2 shows a binary number and its
place values.
The number 1101 is a valid binary number, but it is also a valid decimal num-
ber as well. Sometimes to make it clear which number system is being used, the
Place value:
2 3
2 2
2 1
2 0
Binary number:
1101
2 3
8
2 2
4
2 1
2
2 0
1
Decimal number:
1
1
*
*
+
+
1
1
*
*
+
+
0
0
*
*
+
+
1
1
*
*
=
=
13
FIGURE B.2 Place values in the binary system
Search WWH ::




Custom Search