Description Of BigInteger: modPow(BigInteger exponent, BigInteger m)
The java.math.BigInteger.modPow(BigInteger exponent, BigInteger m) returns a BigInteger whose value is (thisexponent mod m) . (Unlike pow , this method permits negative exponents.)BigInteger.modPow(BigInteger exponent, BigInteger m) method returns thisexponent mod m
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger exponent = new BigInteger("3");
BigInteger bi1 = new BigInteger("2");
BigInteger bi2 = new BigInteger("5");
// perform modPow operation on bi1 using bi2 and exp
BigInteger bi3 = bi1.modPow(exponent, bi2); // 2^3 % 5
System.out.println(bi3); // output 3
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น