public static void main(String[] args) {
int i1 = Integer.MAX_VALUE;
System.out.println(i1);
System.out.println(i1+1);
System.out.println(i1+2);
System.out.println("----------------------");
byte b1 = Byte.MAX_VALUE;
System.out.println(b1);
System.out.println(b1+1);
System.out.println(b1+2);
System.out.println(b1+2147483647-Byte.MAX_VALUE);
System.out.println(b1+2147483647-Byte.MAX_VALUE+1);
}
max値を超えるとmin値になる
byteは計算すると、intのmax値となる
2147483647
-2147483648
-2147483647
----------------------
127
128
129
2147483647
-2147483648