Java Decimal Format getScientificNotation(double value)

Here you can find the source of getScientificNotation(double value)

Description

get Scientific Notation

License

Apache License

Declaration

public static String getScientificNotation(double value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Main {
    public static final int NUMBER_DECIMAL_PLACES = 4;

    public static String getScientificNotation(double value) {
        NumberFormat formatter = new DecimalFormat("0.0E0");
        formatter.setRoundingMode(RoundingMode.HALF_UP);
        formatter.setMinimumFractionDigits(NUMBER_DECIMAL_PLACES);
        return formatter.format(value);
    }/*from   w  w  w  . j  a  v a2s  . c o  m*/
}

Related

  1. getInteger(Double d)
  2. getIntNum(Double value)
  3. getProgressExact(double balance, double cost)
  4. getRealEye(double eye)
  5. getRedondeoHaciaArriba(double pTotal)
  6. getSpaceMessage(final double bytes)
  7. getStandardDeviationString(double[] standardDeviationDoubles)
  8. getStandardDouble(double d, int pL)
  9. getString(Double d)