Java BigDecimal(char[] in, MathContext mc) Constructor

Syntax

BigDecimal(char[] in, MathContext mc) constructor from BigDecimal has the following syntax.

public BigDecimal(char[] in,   MathContext mc)

Example

In the following code shows how to use BigDecimal.BigDecimal(char[] in, MathContext mc) constructor.


import java.math.BigDecimal;
import java.math.MathContext;
/*from w ww. ja  va 2  s .  com*/
public class Main {

  public static void main(String[] args) {
    MathContext mc = new MathContext(3);
    char[] ch = new char[]{'1','2','3','4','5','6','7'};
    BigDecimal bg1 = new BigDecimal(ch,mc);
    System.out.println(bg1);

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger