What is the length of java int
The value range of int is: -2^31—— 2^31-1, that is -2147483648-2147483647.
1. For a positive number, its complement is itself.
2. For a negative number, its complement is the inversion of all the bits of the binary number corresponding to the positive number plus one.
3. The same operation is used to find the original code from the complement of a negative number (all bits are inverted by 1), which is the absolute value of the negative number.
int is 4 bytes, 32 bits.
10000000 00000000 00000000 00000000 is the complement code, the first bit is the sign bit, 1 represents a negative number, so
negates the remaining bits, the result is 1111111 11111111 11111111 11111111, after adding one It is 10000000 00000000 00000000 00000000
4, so the original code refers to -2^31=-2147483648
php Chinese website, a large number of free Java introductory tutorials, welcome Online Learning!
The above is the detailed content of What is the length of java int?. For more information, please follow other related articles on the PHP Chinese website!