Java BigInteger.pow(int exponent)

Syntax

BigInteger.pow(int exponent) has the following syntax.

public BigInteger pow(int exponent)

Example

In the following code shows how to use BigInteger.pow(int exponent) method.


//from   www. j a v a 2 s  .  c  om
import java.math.BigInteger;

public class Main {

  public static void main(String[] args) {

    int exponent = 2;

    // assign value to bi1
    BigInteger bi1 = new BigInteger("6");

    // perform pow operation on bi1 using exponent
    BigInteger bi2 = bi1.pow(exponent);

    System.out.println(bi2);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger