src/org/kocakosm/pitaya/math/Numbers.java
public static int safeMultiply(int a, int b)
	{
		if (a == 0 || b == 0) {
			return 0;
		}
		long max = a < 0 == b < 0 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
		if ((b > 0 && b > max / a) || (b < 0 && b < max / a)) {
			throw new ArithmeticException(
				"Int overflow: " + a + " * " + b);
		}
		return a * b;
	}
public static int safeMultiply(int a, int b)
	{
		if (a == 0 || b == 0) {
			return 0;
		}
		long max = a < 0 == b < 0 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
		if ((b > 0 && b > max / a) || (b < 0 && b < max / a)) {
			throw new ArithmeticException(
				"Int overflow: " + a + " * " + b);
		}
		return a * b;
	}
public static int safeMultiply ( int a , int b ) { if ( a == 0 || b == 0 ) { return 0 ; } long max = a < 0 == b < 0 ? Integer . MAX_VALUE : Integer . MIN_VALUE ; if ( ( b > 0 && b > max / a ) || ( b < 0 && b < max / a ) ) { throw new ArithmeticException ( "Int overflow: " + a + " * " + b ) ; } return a * b ; }
Returns the product of {@code a} and {@code b}, provided the result
fits into an {@code int}.

@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
an {@code int}.
Returns the product of { @code a } and { @code b } provided the result fits into an { @code int } .