Code example for Currency

Methods: getDefaultFractionDigits

0
		if (currencyFormatter == null) {
			currencyFormatter = NumberFormat.getInstance();
		} 
		currencyFormatter.setGroupingUsed(false);
		currencyFormatter.setMaximumFractionDigits(currency
				.getDefaultFractionDigits());
		return currencyFormatter
				.format(amount.setScale(currency.getDefaultFractionDigits(),
						BigDecimal.ROUND_HALF_EVEN));
	} 
 
    /** 
     * This method formats given value in given currency with 
     * properly formatted currency symbol or name. 
     * 
     * This method takes two parameters, amount and currency. The 
     * output is a string with properly formatted value in given 
     * currency. In this version currency symbol or name is formatted 
     * as a part of the output string. 
     * 
     * @param amount Value to be formatted.