Java Double Number Format getFormattedNumber(Double number, int decimals, Locale locale)

Here you can find the source of getFormattedNumber(Double number, int decimals, Locale locale)

Description

get Formatted Number

License

Open Source License

Declaration

public static String getFormattedNumber(Double number, int decimals,
            Locale locale) 

Method Source Code

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

import java.text.NumberFormat;

import java.util.Locale;

public class Main {
    public static String getFormattedNumber(Double number, int decimals,
            Locale locale) {//from   w  ww .  ja va2s .  c o m
        NumberFormat nf = NumberFormat.getInstance(locale);
        nf.setMaximumFractionDigits(decimals);
        nf.setMinimumFractionDigits(decimals);
        return nf.format(number);
    }
}

Related

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