Java Convert String to BigDecimal
Tags: BigDecimal String
In this Java core tutorial we learn how to convert a String into BigDecimal value in Java programming language.
How to convert String to BigDecimal in Java
In Java we can use the BigDecimal constructor to instantiate a new BigDecimal object from a String value as the following example Java program.
StringToBigDecimalExample1.java
import java.math.BigDecimal;
public class StringToBigDecimalExample1 {
public static void main(String... args) {
String stringValue = "123456";
BigDecimal bigDecimal = new BigDecimal(stringValue);
System.out.print(bigDecimal);
}
}
123456
Happy Coding 😊