Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java: Why are the mantissas of the largest and smallest integers different, and why are negative numbers 1 more?
Java: Why are the mantissas of the largest and smallest integers different, and why are negative numbers 1 more?
Not only plastic, but also char byte int long short, because of the problem of binary storage.

Take byte as an example: 1 byte, 8 binary bits. The actual range is-128 to 127.

The most significant bit among the 8 bits is the identification bit, 1 is negative, and 0 is positive.

The normal range of (0/ 1) 000 00 1 to (0/1)11is plus or minus 65438.

The middle 00000000000, all zeros, is a decimal zero, and 100000000 is exactly-128. (? ˇ? ˇ? )

That is, the negative number is 127+1(-128), and the positive number is127 with a 0.