|
|
![]() | Several options exist for the representation of
signed integer values as binary numbers:
| |||||||||||||||||||||||||||
![]() | 1's Complement: A negative number is represented
by changing all zeroes to ones and all ones to zeroes.
Example for an 8 bit representation of 1 and -1:
Supported Range: -127 to 127. Disadvantage: We have two representations for 0: 0000 0000 and 1111 1111.
| |||||||||||||||||||||||||||
![]() | 2's Complement: Similar to 1's complement but
adding 1 for negative numbers:
Supported Range: -128 to 127.
Disadvantage: There is no corresponding positive number
to the smallest negative integer value.
| |||||||||||||||||||||||||||
![]() | Java, the JVM, and all modern processor architectures use
2's complement.
| |||||||||||||||||||||||||||
|
| Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002 |