Java Math Bigdecimal Double Value


Java Math Bigdecimal Double Value

package com.codingdict;



import java.math.*;



public class BigDecimalDemo {



   public static void main(String[] args) {



      // create a BigDecimal object

      BigDecimal bg;



      // create a Double object

      Double d;



      bg = new BigDecimal("1234");



      // assign the converted value of bg to d

      d = bg.doubleValue();



      String str = "Double value of " + bg + " is " + d;



      // print d value

      System.out.println( str );

   }

}