java int is 4 bytes, 32 bits. The value range of int is [-2^31——2^31-1], that is, [-2147483648-2147483647], for positive numbers , its complement is itself. For a negative number, its complement is the inversion of all the bits of the corresponding positive number plus one.
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
int’s value range is -2^31——2^31-1
Extended information
int is an instruction that sends an interrupt to the CPU.
The format is INT vec.
vec is the interrupt vector number, its value is 0~255. The CPU calls the corresponding interrupt routine of the kernel based on this vector number. The instruction operation is:
(SP)←(SP)-2, ((SP) 1:(SP))←(FR)
(IF)←0, (TF)← 0
(SP)←(SP)-2,((SP) 1:(SP))←(CS)
(SP)←(SP)-2,((SP ) 1: (SP)) ← (IP)
(CS) ← (vec*4 2), (IP) ← (vec*4)
related Free learning recommendations: java basic tutorial
The above is the detailed content of How many numbers does java int have?. For more information, please follow other related articles on the PHP Chinese website!