Java Double Number Format prettyDecimalFormat(double d, int numPlaces)

Here you can find the source of prettyDecimalFormat(double d, int numPlaces)

Description

pretty Decimal Format

License

Open Source License

Declaration

public static String prettyDecimalFormat(double d, int numPlaces) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DecimalFormat;

public class Main {
    public static String prettyDecimalFormat(double d, int numPlaces) {
        StringBuilder sb = new StringBuilder("#.");
        for (int i = 0; i < numPlaces; i++) {
            sb.append("#");
        }/*from   w w  w  .  j  ava2 s.  c  o m*/
        DecimalFormat dFormat = new DecimalFormat(sb.toString());
        return dFormat.format(d);
    }
}

Related

  1. getFormattedTwoDecimal(double d)
  2. getFormattedValue(double argDoubleValue)
  3. getTwoDecimalByDecimalFormat(double number)
  4. getValidString(Double value, DecimalFormat formatter)
  5. isDoubleWhitFormat(String pValue)
  6. roundFormat(double d, int i)
  7. shorten(double num)
  8. toDoubleFromHumanFormat(String doubleAsString)
  9. toString(double in, String format)