Java Data Type Tutorial - 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;
/* ww  w. jav a 2 s .  com*/
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.