logo

Convert BigDecimal value to byte value

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

This method to convert a BigDecimal value to byte value.

package simplesolution.dev;

import java.math.BigDecimal;

public class BigDecimalByteValueExamples {

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

        byte byteValue = bigDecimal.byteValue();

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

Happy Coding 😊

Tags: