$ java OverflowWrapDemo

=== int addition wraps silently past Integer.MAX_VALUE ===
Integer.MAX_VALUE       = 2147483647
Integer.MAX_VALUE + 1   = -2147483648  (wrapped to Integer.MIN_VALUE, no exception)
Integer.MIN_VALUE       = -2147483648

=== A realistic case: summing item prices in cents overflows int ===
priceCents * quantity   = 1800000000 * 2 = -694967296  (should be 3,600,000,000 - this is wrong, and no exception was thrown)

=== Multiplication overflows just as silently as addition ===
100000 * 100000 = 1410065408  (true value is 10,000,000,000)

=== long has the same problem, just a much higher ceiling ===
Long.MAX_VALUE          = 9223372036854775807
Long.MAX_VALUE + 1      = -9223372036854775808  (wrapped to Long.MIN_VALUE)
