...
This compliant solution uses the addExact() and multiplyExact() methods defined in the Math class. These methods were added to Java as part of the Java 8 release, and they also either return a mathematically correct value or throw ArithmeticException. The Math class also provides SubtractExactprovides subtractExact() and negateExact() but does not provide any methods for safe division or absolute value.
...