Java BigDecimal.doubleValue()

Syntax

BigDecimal.doubleValue() has the following syntax.

public double doubleValue()

Example

In the following code shows how to use BigDecimal.doubleValue() method.


// w  ww  . j av  a2  s .  c  o m
import java.math.BigDecimal;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg = new BigDecimal("1234");

    // assign the converted value of bg to d
    Double d = bg.doubleValue();

    System.out.println(d);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger