src/org/kocakosm/pitaya/math/Numbers.java
public static long safeSubtract(long a, long b)
	{
		long diff = a - b;
		if (a < 0L != diff < 0L && a < 0L != b < 0L) {
			throw new ArithmeticException(
				"Long overflow: " + a + " - " + b);
		}
		return diff;
	}
public static long safeSubtract(long a, long b)
	{
		long diff = a - b;
		if (a < 0L != diff < 0L && a < 0L != b < 0L) {
			throw new ArithmeticException(
				"Long overflow: " + a + " - " + b);
		}
		return diff;
	}
Returns the difference of {@code a} and {@code b}, provided the
result fits into a {@code long}.

@param a the first operand.
@param b the second operand.

@return {@code a - b}.

@throws ArithmeticException if {@code a - b} can't be represented by
a {@code long}.