I have noticed that the class BigIntegerreceived a new method in Java 8: intValueExact().
My question is why?
BigInteger bigInt = ... ;
bigInt.intValueExact();
BigIntegeralready had intValue(). intValueExact()designed to throw an error when yours BigIntegerdoes not have an exact value int, but my question is: how could one give a value BigIntegerthat would not correspond to the exact one int? Can someone provide an example of when this method will call ArithmeticException??
source
share