public class Temp {
public static void main(String[] args) {
int max = Integer.MAX_VALUE;
int min = Integer.MIN_VALUE;
System.out.println("int的最大值: " + max); //01111111 11111111 11111111 11111111
System.out.println("int的最大值+1: " + (max+1)); //11111111 11111111 11111111 11111111
System.out.println("int的最小值: " + min); //10000000 00000000 00000000 00000000
System.out.println("int的最小值-1: " + (min-1)); //01111111 11111111 11111111 11111111
}
}
输出:
int的最大值: 2147483647
int的最大值+1: -2147483648
int的最小值: -2147483648
int的最小值-1: 2147483647