Java Currency Format currency(double value, NumberFormat nformat)

Here you can find the source of currency(double value, NumberFormat nformat)

Description

Converts a number representing dollars to a currency display string using the supplied number format.

License

Open Source License

Declaration

protected static String currency(double value, NumberFormat nformat) 

Method Source Code


//package com.java2s;
import java.text.NumberFormat;
import java.util.Locale;

public class Main {
    /**//w w w . j  ava  2s . c om
     * Converts a number representing currency in the specified locale to a
     * displayable string.
     */
    public static String currency(double value, Locale locale) {
        return currency(value, NumberFormat.getCurrencyInstance(locale));
    }

    /**
     * Converts a number representing dollars to a currency display
     * string using the supplied number format.
     */
    protected static String currency(double value, NumberFormat nformat) {
        return nformat.format(value);
    }
}

Related

  1. currency(double amount, String language, String country)
  2. currency(double amount, String language, String country)
  3. currencyFormat()
  4. format2CurrencyWithComma(double amt)
  5. formatAsCurrency(BigDecimal nAmount)
  6. formatAsCurrency(final double value)