Java Currency Format roundToCurrencyString(double amount)

Here you can find the source of roundToCurrencyString(double amount)

Description

round To Currency String

License

Apache License

Declaration

public static String roundToCurrencyString(double amount) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.NumberFormat;

public class Main {
    public static String roundToCurrencyString(double amount) {
        NumberFormat myFormatter = NumberFormat.getNumberInstance();
        myFormatter.setMinimumFractionDigits(2);
        myFormatter.setMaximumFractionDigits(2);
        myFormatter.setGroupingUsed(false);
        return myFormatter.format(amount);
    }/* w ww .j a v a 2s  .c o m*/
}

Related

  1. getCurrencyFormat()
  2. getCurrencyFormat(final Locale locale)
  3. getCurrencyFormatter()
  4. parseCurrency(String currency)
  5. removeTrailingZeroes(BigDecimal value, boolean isCurrency)
  6. toCurrency(Object objectValue)
  7. toCurrencyAmountStr(Long microAmount)
  8. toCurrencyFormat(String input)
  9. toCurrencyFormat(String pattern, double value)