Java Double Number Format getTwoDecimalByDecimalFormat(double number)

Here you can find the source of getTwoDecimalByDecimalFormat(double number)

Description

get Two Decimal By Decimal Format

License

Open Source License

Declaration

public static String getTwoDecimalByDecimalFormat(double number) 

Method Source Code

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

public class Main {

    public static String getTwoDecimalByDecimalFormat(double number) {
        String decimal = "";
        java.text.DecimalFormat df = new java.text.DecimalFormat("#.##");
        decimal = df.format(number);/*from w  w w  .j a  va  2s.c om*/
        return decimal;
    }
}

Related

  1. getFormatAmount(Double d)
  2. getFormattedNumber(Double number, int decimals, Locale locale)
  3. getFormattedString(double d, int numDecimalPlaces)
  4. getFormattedTwoDecimal(double d)
  5. getFormattedValue(double argDoubleValue)
  6. getValidString(Double value, DecimalFormat formatter)
  7. isDoubleWhitFormat(String pValue)
  8. prettyDecimalFormat(double d, int numPlaces)
  9. roundFormat(double d, int i)