Java BigDecimal(long val) Constructor

Syntax

BigDecimal(long val) constructor from BigDecimal has the following syntax.

public BigDecimal(long val)

Example

In the following code shows how to use BigDecimal.BigDecimal(long val) constructor.


import java.math.BigDecimal;
/*from  w w w  . j a va 2 s  .  com*/
public class Main {

  public static void main(String[] args) {
    BigDecimal bg1 = new BigDecimal(123456789L);
    System.out.println(bg1);

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger