Java BigInteger divideAndRemainder() methodThe divideAndRemainder() methodof java BigInteger class returns an array of two BigIntegerswith being the first one be the quotient while second index corresponds to the remainder. Syntax:Parameter:val-value by which this BigInteger is to be divided, and the remainder computed. Returns:An array of two BigIntegers: the quotient (this / val) is the initial element, and the remainder (this % val) is the final element. Throws:ArithmeticException- if val is zero. Example 1Test it NowOutput: Result of divideAndRemainderoperaion : Quotient is -37 Remainder is 0 Example 2Test 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