Java BigInteger divide() methodThe divide() method of Java BigInteger class is used to divide two BigInteger values.This method returns a BigInteger whose value is (this / val). Syntax:Returns:This method returns a BigInteger whose value is (this / val) Throws:ArithmeticException- if val is zero. Note: Since the result would be BigInteger and would not be able to hold fractions then the remainder would be discarded.Example 1Test it NowOutput: Result of divideoperation is-22 Example 2Test it NowOutput: Result of divideoperation is 22 Example 3Test it NowOutput: java.lang.ArithmeticException: BigInteger divide by zero Next TopicJava BigInteger |
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