Java.math.BigInteger Class Java.math.BigInteger.divideAndRemainder() Method - Java.math Package

What is Java math BigInteger divideAndRemainder() Method?


The java.math.BigInteger.divideAndRemainder(BigInteger val) returns an array of BigIntegers containing (this / val) observed by means of (this % val).


Following is the declaration for java.math.BigInteger.divideAndRemainder() technique.


Val − value through which this BigInteger is to be divided, and the remainder computed.

Return value

This approach returns an array of two BigIntegers: the quotient (this / val) is the initial detail, and the remainder (this % val) is the final detail.


Arithmetic Exception − If val is zero.


The following example suggests the use of math.BigInteger.divideAndRemainder() technique.

Let us compile and run the above program, this will produce the following result −

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Java.math Package Topics