PHYS 2411
COMPUTATIONAL SCIENCE I

Fall Semester, 1998

Instructor: Joel E. Tohline
tohline@rouge.phys.lsu.edu

Character and Integer Definitions in Binary and HEX
Page last updated:

Binary Representation of Selected 8-bit Integers
Integer
[byte]
Binary HEX ASCII
equivalent
EBCDIC
equivalent
If bgcolor = HEX
R G B RGB
0
0000 0000
00
CTRL-@
[NUL]
---
000000 000000 000000 000000
1
0000 0001
01
CTRL-a
[SOH]
---
010000 000100 000001 010101
2
0000 0010
02
CTRL-b
[STX]
---
020000 000200 000002 020202
3
0000 0011
03
CTRL-c
[ETX]
---
030000 000300 000003 030303
4
0000 0100
04
CTRL-d
[EOT]
---
040000 000400 000004 040404
5
0000 0101
05
CTRL-e
[ENQ]
[Horiz. Tab]
050000 000500 000005 050505
6
0000 0110
06
CTRL-f
[ACK]
[Lower Case]
060000 000600 000006 060606
7
0000 0111
07
CTRL-g
[BEL]
[DEL]
070000 000700 000007 070707
.
.
.
.
.
.
.
.
.
127
0111 1111
7F
DEL
[Delete]
"
[Double Quote]
7F0000 007F00 00007F 7F7F7F

Binary Representation of Selected 8-bit Integers
Integer
[byte]
Binary* HEX ASCII
equivalent
EBCDIC
equivalent
If bgcolor = HEX
R G B RGB
-128
1000 0000
80
---
---
800000 008000 000080 808080
.
.
.
.
.
.
.
.
.
-8
1111 1000
F8
---
8
F80000 00F800 0000F8 F8F8F8
-7
1111 1001
F9
---
9
F90000 00F900 0000F9 F9F9F9
-6
1111 1010
FA
---
---
FA0000 00FA00 0000FA FAFAFA
-5
1111 1011
FB
---
---
FB0000 00FB00 0000FB FBFBFB
-4
1111 1100
FC
---
---
FC0000 00FC00 0000FC FCFCFC
-3
1111 1101
FD
---
---
FD0000 00FD00 0000FD FDFDFD
-2
1111 1110
FE
---
---
FE0000 00FE00 0000FE FEFEFE
-1
1111 1111
FF
---
---
FF0000 00FF00 0000FF FFFFFF
*All of the integer data types in Java [byte, short, int, long] are "signed two's complement integers." This means that the integer minus one (-1) is represented by setting all binary bits to "1" (for example, for the "byte" data type illustrated in this table, the binary representation of minus one is 1111 1111) then all other negative integers are obtained by subtracting 1 from the previous negative number, in succession.

With this "two's complement" convention:

  1. The highest order (left-most) binary bit of every negative integer is "1";
  2. The magnitude of any negative integer can be obtained by first subtracting 1 from the binary representation of the number, then changing each 0 in the binary number to 1 and each 1 to 0.
  3. The magnitude of the largest negative integer is 2n-1, where "n" is the number of bits in the integer data type (hence, -128 is the largest negative integer that can be represented by a Java "byte").
  4. The largest positive integer is (2n-1 - 1), where "n" is the number of bits in the integer data type (hence, +127 is the largest positive integer that can be represented by a Java "byte").


| Syllabus | Textbooks |
| Calendar | Q1 | Q2 | Q3 | Q4 |