public static int subtractExact (int x, int y)

Returns the difference of the arguments, throwing an exception if the result overflows an int.

Parameters:
x    the first value
y    the second value to subtract from the first

Returns:  the result

Exceptions:
ArithmeticException    if the result overflows an int

See also:
Math.subtractExact(int,int)

Since:  1.8