logo

Convert BigDecimal value into short value

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

This method to convert a BigDecimal value to short value.

package simplesolution.dev;

import java.math.BigDecimal;

public class BigDecimalShortValueExamples {

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

        short shortValue = bigDecimal.shortValue();

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

Happy Coding 😊

Tags: