$ java WideningAndBigIntegerDemo === Widening to long fixes the int-range overflow from OverflowWrapDemo === int: Integer.MAX_VALUE + 1 = -2147483648 (wrong) long: (long) Integer.MAX_VALUE + 1 = 2147483648 (correct) === Widening only raises the ceiling - long still overflows eventually === Long.MAX_VALUE + 1 = -9223372036854775808 (wrapped to Long.MIN_VALUE - same bug, bigger numbers) === BigInteger never overflows - it grows to fit the true value === BigInteger.valueOf(Long.MAX_VALUE).add(ONE) = 9223372036854775808 BigInteger.valueOf(2).pow(100) = 1267650600228229401496703205376 (that value has no exact long or int representation at all)