Java – How to create BigDecimal from string value ?

Problem Statement

You want to create a BigDecimal value from a string type in Java.


Use the BigDecimal class and pass the string value in the constructor to create the BigDecimal value as shown below.

import java.math.BigDecimal;

public class Main {

    public static void main(String[] args) {

        System.out.println(" Java Tutorials");
        String str = "198654586.297292792";

        // Creating BigDecimal from string value in Java
        BigDecimal input = new BigDecimal(str);



The output of the above program is Java Tutorials


%d bloggers like this: