The java.math.BigInteger class provides methods to perform arithmetic operations on large integers that cannot be represented by the primitive data types. The remainder method of BigInteger class returns the remainder of dividing this BigInteger by another BigInteger. It returns a BigInteger whose value is the remainder of the division of this BigInteger by the specified BigInteger. The resulting BigInteger is computed as this % val, where % represents the modulo operator.
Code example using java.math.BigInteger remainder:
BigInteger a = new BigInteger("75"); BigInteger b = new BigInteger("16"); BigInteger c = a.remainder(b); System.out.println(c);
Output: 11
The above code creates two BigInteger objects, a and b, with the values of 75 and 16, respectively. Then, the remainder method is used on a with the parameter b. This gives the result of 11, which is assigned to c. Finally, the value of c is printed.
The BigInteger class is a part of the java.math package.
Java BigInteger.remainder - 18 examples found. These are the top rated real world Java examples of java.math.BigInteger.remainder extracted from open source projects. You can rate examples to help us improve the quality of examples.