Java Double Number Format doubleFormat(double number)

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

Description

A number formatted in a String

License

Open Source License

Parameter

Parameter Description
number The number to format

Return

The formatted number

Declaration

public static String doubleFormat(double number) 

Method Source Code

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

import java.text.NumberFormat;
import java.util.Locale;

public class Main {
    /**/*from ww  w  .j av  a  2s  . co  m*/
     * A number formatted in a String
     * 
     * @param number The number to format
     * 
     * @return The formatted number
     */
    public static String doubleFormat(double number) {
        NumberFormat nf_out = NumberFormat.getNumberInstance(Locale.UK);
        nf_out.setMaximumFractionDigits(2);
        return nf_out.format(number);
    }
}

Related

  1. convertDouble(double damage)
  2. doubleFormat(Double d)
  3. doubleFormat(double d)
  4. doubleFormat(double val, boolean hiRes)
  5. format(double b)
  6. format(double d, int decimals)
  7. format(Double decimal)