Java Utililty Methods Currency Format

List of utility methods to do Currency Format

  1. HOME
  2. Java
  3. C
  4. Currency Format

Description

The list of methods to do Currency Format are organized into topic(s).

Method

String currency(double amount, String language, String country)
Format a currency amount in a given locale.
Locale locale = null;
if (language == null || country == null) {
 locale = Locale.getDefault();
} else {
 locale = new Locale(language, country);
return currency(amount, locale);
String currency(double amount, String language, String country)
Format a currency amount for a given language and country.
Locale locale = getLocale(language, country);
return currency(amount, locale);
String currency(double value, NumberFormat nformat)
Converts a number representing dollars to a currency display string using the supplied number format.
return nformat.format(value);
NumberFormat currencyFormat()
currency Format
NumberFormat format = NumberFormat.getNumberInstance();
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(2);
return format;
String format2CurrencyWithComma(double amt)
format Currency With Comma
String formattedAmount = format2DecimalPointMoneyWithComma(amt);
if (formattedAmount.startsWith("(")) {
 return formattedAmount.replace("(", "($");
} else {
 return "$" + formattedAmount;
String formatAsCurrency(BigDecimal nAmount)
Formatea cantidades como moneda utilizando el default locale.
return nfCurrency.format(nAmount);
String formatAsCurrency(final double value)
format As Currency
String str = dFormat.format(value);
if (str.endsWith(".00")) {
 str = str.substring(0, str.length() - 3);
return str;
String formatAsCurrency(Number amount)
Convenience method for converting Number to currency string representation with minimal overhead.
return amount == null ? "" : CURRENCY_FORMAT.get().format(amount);
String formatAsCurrency(Number value)
format As Currency
if (value == null) {
 return "";
return currencyFormat.format(value);
String formatCurrency(BigDecimal amount)
format Currency
if (amount.compareTo(BigDecimal.ZERO) <= 0) {
 return "0";
DecimalFormat df = new DecimalFormat("#,###.00");
return df.format(amount);


AltStyle によって変換されたページ (->オリジナル) /