The maximum integer is 65535 as int's nd int expressions are by default 16 bit. For expressions that are to yield long values you should append a letter L to at least one of the constants: long Delay3 = 100 * 10000L;
Otherwise the compiler sees an int value 100, an int value 10000, multiplies then in 16-bit arithmetic, giving a wrong result, and only then converts to a long. The L forces the constant to be long, and int x long gives long so the result is calculated in 32-bit arithmetic correctly.