Java BigInteger.modPow(BigInteger exponent, BigInteger m)

Syntax

BigInteger.modPow(BigInteger exponent, BigInteger m) has the following syntax.

public BigInteger modPow(BigInteger exponent,   BigInteger m)

Example

In the following code shows how to use BigInteger.modPow(BigInteger exponent, BigInteger m) method.


/*from  w w  w  . j  av  a2s  . com*/
import java.math.BigInteger;

public class Main {

  public static void main(String[] args) {

    BigInteger exponent = new BigInteger("2");

    BigInteger bi1 = new BigInteger("7");
    BigInteger bi2 = new BigInteger("20");

    // perform modPow operation on bi1 using bi2 and exp
    BigInteger bi3 = bi1.modPow(exponent, bi2);

    System.out.println(bi3);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger