Java BigDecimal intValueExact() MethodThe intValueExact() method of java BigDecimal class is used to Convert a BigDecimal to an int type as well as this method also check for the lost information. Syntax:Parameter:No Exception:If this has a non-zero fractional part, or will not fit in an int, then it throws an ArithmeticException. Returns:It returns int value from BigDecimal. Example 1Test it NowOutput: Returned Exact Integer Value of 17674137 is = 17674137 Example 2Test it NowOutput: Returned Exact Integer Value of -623341 is = -623341 Example 3Test it NowOutput: ArithmeticException Example 4Test it NowOutput: ArithmeticException Next TopicJava BigDecimal |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India