Java Fraction Format formatNumber(double decimal)

Here you can find the source of formatNumber(double decimal)

Description

format Number

License

Open Source License

Declaration

public static String formatNumber(double decimal) 

Method Source Code


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

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

public class Main {
    public static String formatNumber(double decimal) {
        DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance();
        symbols.setGroupingSeparator(' ');
        symbols.setDecimalSeparator(',');
        DecimalFormat formatter = new DecimalFormat("###,###.###", symbols);
        formatter.setMaximumFractionDigits(3);
        formatter.setMinimumFractionDigits(3);
        return formatter.format(decimal);
    }//from   w w  w .  j  a  va 2 s. c  o m
}

Related

  1. formatNoGrouping(double value)
  2. formatNormalDouble(double value)
  3. formatNum(double d)
  4. formatNum(double num, int numfracdigits)
  5. formatNum(float value)
  6. formatNumber(double i)
  7. formatNumber(double num)
  8. formatNumber(double num)
  9. formatNumber(double number)