How to calculate the rest with "%" from two BigInteger numbers?
How to calculate the rest with "%" from two BigInteger numbers?
Just use the mod
of class BigInteger
.
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
class Ideone {
public static void main (String[] args) throws java.lang.Exception {
BigInteger bi1, bi2, bi3;
bi1 = new BigInteger("-100");
bi2 = new BigInteger("3");
bi3 = bi1.mod(bi2);
System.out.println(bi3);
}
}
See running on ideone .