1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
class Overflow { static int test(int x) { return (2*x)/2; } public static void main(String argv[]) { int x = Integer.MAX_VALUE; if (test(x) == x) throw new RuntimeException (); } }