code: public static int mulAndCheck (int x, int y) throws ArithmeticException {
  		long m = ((long)x) * ((long)y);
  		if (m < Integer.MIN_VALUE || m > Integer.MAX_VALUE) {
  			throw new ArithmeticException();
  		}
  		return (int)m;
  	}
docs: Multiply two integers, checking for overflow.
  
  @param x first factor
  @param y second factor
  @return the product {@code x * y}.
  @throws ArithmeticException if the result can not be represented as an {@code int}.