class Program {
public static void main(String[] args) {
try {
int n = Math.multiplyExact(101, 3);
System.out.println(n);
n = Math.multiplyExact(2147483647, 2);
System.out.println(n);
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
/*
run:
303
java.lang.ArithmeticException: integer overflow
*/