Java Reference
In-Depth Information
base value is appended as a subscript to the end of a number. Therefore you can
distinguish between 1101 2 , which is equivalent to 13 in decimal, and 1101 10 (one
thousand, one hundred and one), which in binary is represented as 10001001101 2 .
A number system with base N has N digits (0 through N −1). As we have seen,
the decimal system has 10 digits (0 through 9), and the binary system has two
digits (0 and 1). They all work the same way. For instance, the base-5 number
system has five digits (0 to 4).
Note that, in any number system, the place value of the digit furthest to the
right is 1, since any base raised to the zero power is 1. Also notice that the value
10, which we refer to as “ten” in the decimal system, always represents the base
value in any number system. In base 10, 10 is one 10 and zero 1's. In base 2, 10
is one 2 and zero 1's. In base 5, 10 is one 5 and zero 1's.
Bases Higher Than 10
Since all number systems with base N have N digits, then base 16 has 16 digits.
But what are they? We are used to the digits 0 through 9, but in bases higher than
10, we need a single digit, a single symbol, that represents the decimal value 10.
In fact, in base 16, which is also called hexadecimal, we need digits that represent
the decimal values 10 through 15.
For number systems higher than 10, we use alphabetic characters as single digits
for values greater than 9. The hexadecimal digits are 0 through F, where 0 through 9
represent the first 10 digits, and A represents the decimal value 10, B represents 11, C
represents 12, D represents 13, E represents 14, and F represents 15.
Therefore the number 2A8E is a valid hexadecimal number. The place values
are determined as they are for decimal and binary, using increasing powers of the
base. So in hexadecimal, the place values are powers of 16. Figure B.3 shows how
the place values of the hexadecimal number 2A8E contribute to the overall value.
Place value:
16 3
16 2
16 1
16 0
Hexadecimal number:
2A8E
16 3
4096
16 2
256
16 1
16
16 0
1
Decimal number:
2
2
*
*
+
+
10
10
*
*
+
+
8
8
*
*
+
+
14
14
*
*
=
=
10893
FIGURE B.3 Place values in the hexadecimal system
 
Search WWH ::




Custom Search