Java Double Number Format getFormatAmount(Double d)

Here you can find the source of getFormatAmount(Double d)

Description

get Format Amount

License

Open Source License

Declaration

public static String getFormatAmount(Double d) 

Method Source Code


//package com.java2s;
import java.text.DecimalFormat;

public class Main {

    public static String getFormatAmount(Double d) {
        if (d == null) {
            return "0.00";
        }/*from   w  ww  . j  av  a 2 s .  com*/
        DecimalFormat df = new DecimalFormat("0.00");
        return df.format(d);
    }

    public static String getFormatAmount(int i) {
        DecimalFormat df = new DecimalFormat("0.00");
        return df.format(i);
    }
}

Related

  1. formatDoubleToString(double d)
  2. formatDoubleToString(double n)
  3. formatDoubleWithPadding(String value, int length, char pad)
  4. getFormat(double d)
  5. getFormat(double value)
  6. getFormattedNumber(Double number, int decimals, Locale locale)
  7. getFormattedString(double d, int numDecimalPlaces)
  8. getFormattedTwoDecimal(double d)
  9. getFormattedValue(double argDoubleValue)