Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java int calculation problem
Java int calculation problem
First of all, you have to understand what binary is. The data stored in the computer are all represented in binary, namely 0 and 1. Int is a positive number and a negative number. If the first digit is 0, it is positive and 1 is negative. In Java, the total number of digits of int * * * is 32, and only when the upper limit is positive can the first digit be 0, and all other digits can be 1 (that is, 2 31-1). But if the positive number is too large, such as 2 3 1, the computer changes the first digit to 1.

/snipps/article/details/5408651Look at this, it's quite clear.