Java BigDecimal .toEngineeringString ()

Syntax

BigDecimal.toEngineeringString() has the following syntax.

public String toEngineeringString()

Example

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


//  ww w  .  j av a  2  s .c  o m

import java.math.BigDecimal;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg = new BigDecimal("1E+4");

    
    System.out.println("Engineering string value of " +
                 bg + " is " + bg.toEngineeringString());
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger