Java convert short to BigDecimal

Tags: short BigDecimal

In this Java core tutorial we learn how to convert a short value into a BigDecimal object in Java programming language.

How to convert short to BigDecimal in Java

In Java, with a given short value we can use the BigDecimal.valueOf(long val) static method to create a new BigDecimal object as the following example Java code.

ConvertShortToBigDecimalExample1.java

import java.math.BigDecimal;

public class ConvertShortToBigDecimalExample1 {
    public static void main(String... args) {
        short shortValue = 567;

        BigDecimal bigDecimal = BigDecimal.valueOf(shortValue);

        System.out.println("short value: " + shortValue);
        System.out.println("BigDecimal value: " + bigDecimal);
    }
}
The output as below.
short value: 567
BigDecimal value: 567

Happy Coding 😊

Java convert short to long

Java convert short to byte

Java convert short to BigInteger

Java convert short to char

Java convert long to short

Java convert char to short

Java convert byte to short