Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Value range of int in java
Value range of int in java
The range of int is-231-231-kloc-0/,that is,-2147483648-2147483647.

1. For a positive number, its complement is itself.

2. For a negative number, its complement is the binary number of its corresponding positive number, and all the bits are inverted and then added with one.

3. Finding the original code from the complement of a negative number is the same operation (all bits are inverted+1), which is the absolute value of a negative number.

Int is 4 bytes, 32 bits,

10000000 00000000 00000000 00000000? Is the complement, the first bit is the sign bit, 1 represents a negative number, so

Invert the remaining bits, and the result is1111111165438. +011111111,after adding one, it is/kloc.

4. So the original code refers to -2 3 1 =-2 147483648.

The range of int is-231-231-1.

Extended data

Int is an instruction to send an interrupt to the CPU.

The format is INT vec.

Vec is the interrupt vector number, and its value is 0~255. The CPU calls the interrupt routine corresponding to the kernel according to 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)

reference data

Baidu encyclopedia -int