Description Of BigInteger: mod(BigInteger m)
The java.math.BigInteger.mod(BigInteger m) returns a BigInteger whose value is (this mod m). This method differs from remainder in that it always returns a non-negative BigIntegerBigInteger.mod(BigInteger m) This method returns a BigInteger object whose value is this mod m.
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("2");
BigInteger bi2 = new BigInteger("3");
System.out.println(bi1.mod(bi2)); // output 2
System.out.println(bi2.mod(bi1)); // output 1
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น