Java BigDecimal.valueOf(long val)

Syntax

BigDecimal.valueOf(long val) has the following syntax.

public static BigDecimal valueOf(long val)

Example

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


import java.math.BigDecimal;
//from w  w  w  . j  av a2 s  .  co  m
public class Main {

    public static void main(String[] args) {
        Long l = new Long("12345678");

        BigDecimal bg = BigDecimal.valueOf(l);

        System.out.println( bg );
    }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger