Java Fraction Format formatNum(double d)

Here you can find the source of formatNum(double d)

Description

format Num

License

Open Source License

Declaration

public static String formatNum(double d) 

Method Source Code


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

public class Main {
    public static String formatNum(double d) {
        DecimalFormat df = new DecimalFormat("####,##0.00");

        String result = df.format(d);

        if (".00".equals(result)) {
            result = "0" + result;
        }/*from w  w w.j a va 2 s.  com*/

        return result;
    }
}

Related

  1. formatKnots(double v)
  2. formatManeyPattern(String pattern, Double amount)
  3. formatMetricsDecimal(double value)
  4. formatNoGrouping(double value)
  5. formatNormalDouble(double value)
  6. formatNum(double num, int numfracdigits)
  7. formatNum(float value)
  8. formatNumber(double decimal)
  9. formatNumber(double i)