Java BigDecimal.pow(int n)

Syntax

BigDecimal.pow(int n) has the following syntax.

public BigDecimal pow(int n)

Example

In the following code shows how to use BigDecimal.pow(int n) method.


// w  w w .  jav a 2 s . c o m

import java.math.BigDecimal;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg1 = new BigDecimal("1.23");

    // apply pow method on bg1
    BigDecimal bg2 = bg1.pow(3);

    System.out.println(bg2);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger