/**
 * multiplies the two parameters, throwing a MyOverflowException if the result is not an int.
 * @param a multiplier
 * @param b multiplicand
 * @result product
 */
public static int multSafe(int a, int b) throws MyOverflowException
{
   long result = (long)a * (long)b;
   int desiredhibits = - ((int)( result >>> 31 ) & 1);
   int actualhibits = (int)( result >>> 32 );
   if ( desiredhibits == actualhibits )
      {
      return(int)result;
      }
   else
      {
      throw new MyOverflowException( a + " * " + b + " = " + result );
      }
}