logo

Convert BigDecimal value into long value

Java Code Examples for java.math.BigDecimal.longValue()

This method to convert a BigDecimal value to long value.

package simplesolution.dev;

import java.math.BigDecimal;

public class BigDecimalLongValueExamples {

    public static void main(String... args) {
        BigDecimal bigDecimal = new BigDecimal("999999999.01");

        long longValue = bigDecimal.longValue();

        System.out.println(bigDecimal);
        System.out.println(longValue);
    }
}

Happy Coding 😊

Tags: