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

What is Java math BigInteger divideAndRemainder() Method?

Description

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

Declaration

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

Parameters

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.

Exception

Arithmetic Exception − If val is zero.

Example

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 DMCA.com Protection Status

Java.math Package Topics