List of usage examples for java.text DecimalFormat getCurrencyInstance
public static NumberFormat getCurrencyInstance(Locale inLocale)
From source file:org.mifos.platform.accounting.service.AccountingDataCacheManager.java
private String parseNumber(String number) { // FIXME should use this from common util StringBuilder pattern = new StringBuilder(); DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.ENGLISH); for (Short i = 0; i < DIGITS_BEFORE_DECIMAL; i++) { pattern.append('#'); }//from w ww .j a v a 2 s.c o m pattern.append(decimalFormat.getDecimalFormatSymbols().getDecimalSeparator()); for (short i = 0; i < getDigitsAfterDecimal(); i++) { pattern.append('#'); } decimalFormat.applyLocalizedPattern(pattern.toString()); decimalFormat.setDecimalSeparatorAlwaysShown(false); decimalFormat.setMinimumFractionDigits(getDigitsAfterDecimal()); return decimalFormat.format(Double.parseDouble(number)); }