The numbers in the computer are stored in binary mode, the first bits is the sign bit, 0 is positive, and 1 is negative.
The original code, the inverse code, the complement is the computer to store the digital use the code
1, the original code, anti-code, the concept of complement
Original code : symbol bit plus this number absolute value
For example, a positive integer 1 of the 8-bit binary source code is 00000001 negative integer-1 of 8 is the binary original code 10000001
Anti- code : The inverse of a positive number is its own, negative anti-code is on the basis of the original code in addition to the symbol bit all the bit counter
For example, the 8-bit binary source code of positive integer 1 is 00000001 and its inverse code is 00000001.
Negative integer-1 of 8 is the binary original code 10000001 with its anti-code of 11111110
complement : a positive complement is its own, minus the complement of its anti-code plus 1
For example, the 8-bit binary source code of positive integer 1 is 00000001 and its complement is 00000001
Negative integer-1 of 8 is a binary source code of 10000001 with an inverse code of 11111110 whose complement is 11111110 + 00000001 = 11111111
2. Numbers in the Java language are stored in a complementary fashion
Verify the following:
By negative integer 10 unsigned right shift one positive 2147483643 know that the numbers in Java are stored in complement
Analysis:
If the storage method is the original code-10 stored binary representation is 10000000 00000000 00000000 00001010 unsigned Right shift one has 01000000 00000000 00000000 00000101 This number is decimal 1 073741829
If the store is in reverse code-10 stored binary representation is 11111111 11111111 11111111 11110101 unsigned Right shift one has 01111111 11111111 11111111 11111010 This number is decimal 21 47483642
If the storage method is complement-10 stored binary representation is 11111111 11111111 11111111 11110110 unsigned Right shift one has 01111111 11111111 11111111 11111011 This number is decimal 21 47483643
Negative integer 10 in Java unsigned right shift one positive 2147483643 is the same as the method of storing the complement analysis.
So the digital storage in Java is in the form of complement.
The original code, anti-code, the complement of the relevant content and the Java language in which code is expressed in