logo

Convert BigDecimal value into float value

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

This method to convert a BigDecimal value to float value.

package simplesolution.dev;

import java.math.BigDecimal;

public class BigDecimalFloatValueExamples {

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

        float floatValue = bigDecimal.floatValue();

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

Happy Coding 😊

Tags: