Can someone provide me with a detailed explanation of why 2,147,483,647 is the maximum integer value in Java?
1 Answer
Because the total value an int can hold in Java is 2^32 (2 to the power of 32, in other words a 32 bit number); (2^31 for negative numbers and (2^31)-1 for positive numbers and 1 for the 0)
1 Comment
user85421
missing that Java primitive integer values are signed two's-complement integers (excluding
char) - JLS 4.2. Primitive Types and Values