src/org/kocakosm/pitaya/math/Numbers.java
public static int safeToInt(long a)
	{
		if (a >= Integer.MIN_VALUE && a <= Integer.MAX_VALUE) {
			return (int) a;
		}
		throw new ArithmeticException(a + " can't be cast to int");
	}
public static int safeToInt(long a)
	{
		if (a >= Integer.MIN_VALUE && a <= Integer.MAX_VALUE) {
			return (int) a;
		}
		throw new ArithmeticException(a + " can't be cast to int");
	}
Casts the given {@code long} value to {@code int}, if possible.

@param a the value to cast to {@code int}.

@return the casted value.

@throws ArithmeticException if {@code a} cannot be cast into an
{@code int}.