Java Reference
In-Depth Information
TABLE 1-1 Binary Units
1
Unit
Symbol
Bits/Bytes
Byte
8 bits
2 10 bytes ¼ 1024 bytes
Kilobyte
KB
1024 KB ¼ 2 10 KB ¼ 2 20 bytes ¼ 1,048,576 bytes
Megabyte
MB
1024 MB ¼ 2 10 MB ¼ 2 30 bytes ¼ 1,073,741,824 bytes
Gigabyte
GB
1024 GB ¼ 2 10 GB ¼ 2 40 bytes ¼ 1,099,511,627,776
bytes
Terabyte
TB
1024 TB ¼ 2 10 TB ¼ 2 50 bytes ¼ 1,125,899,906,842,624
bytes
Petabyte
PB
1024 PB ¼ 2 10 PB ¼ 2 60 bytes ¼
1,152,921,504,606,846,976 bytes
Exabyte
EB
1024 EB ¼ 2 10 EB ¼ 2 70 bytes ¼
1,180,591,620,717,411,303,424 bytes
Zettabyte
ZB
Every letter, number, or special symbol (such as * or { ) on your keyboard is encoded as a
sequence of bits, each having a unique representation. The most commonly used
encoding scheme on personal computers is the seven-bit American Standard Code
for Information Interchange (ASCII). The ASCII data set consists of 128 characters,
numbered 0 through 127. (Note that 2 7 ¼ 128 and 2 8 ¼ 256.) That is, in the ASCII data
set, the position of the first character is 0, the position of the second character is 1, and so
on. In this scheme, A is encoded as 1000001 . In fact, A is the 66th character in the ASCII
character code, but its position is 65 because the position of the first character is 0.
Furthermore, 1000001 is the binary representation of 65 . The character 3 is encoded as
0110011 . For a complete list of the printable ASCII character set, refer to Appendix C.
The number system that we use in our daily life is called the decimal system or base 10.
Because everything inside a computer is represented as a sequence of 0s and 1s, that
is, binary numbers, the number system that a computer uses is called binary or base 2.
We indicated in the preceding paragraph that the number 1000001 is the binary
representation of 65. Appendix D describes how to convert a number from base 10 to
base 2 and vice versa. Appendix D also describes how to convert a number between
base 2 and base 16 (hexadecimal) and between base 2 and base 8 (octal).
Inside the computer, every character is represented as a sequence of eight bits, that is, as a
byte. Because ASCII is a seven-bit code, you must add 0 to the left of the ASCII
encoding of a character. Hence, inside the computer, the character A is represented as
01000001 , and the character 3 is represented as 00110011 .
Search WWH ::




Custom Search