Java Money & Currency

This commit is contained in:
root
2017-02-27 15:13:19 -04:00
parent fc570b9e2e
commit bb1b9c4ca4
6 changed files with 269 additions and 254 deletions

View File

@@ -81,7 +81,11 @@ public class JavaMoney {
LOGGER.info("Money & FastMoney operations : " + calcMoneyFastMoney);
monetaryAmounts = new MonetaryAmount[] { Money.of(100, "CHF"), Money.of(10.20, "CHF"), Money.of(1.15, "CHF"), };
monetaryAmounts =
new MonetaryAmount[] {
Money.of(100, "CHF"),
Money.of(10.20, "CHF"),
Money.of(1.15, "CHF"), };
sumAmtCHF = Money.of(0, "CHF");
for (MonetaryAmount monetaryAmount : monetaryAmounts) {
sumAmtCHF = sumAmtCHF.add(monetaryAmount);
@@ -134,7 +138,7 @@ public class JavaMoney {
usFormatted = formatUSD.format(oneDolar);
LOGGER.info("One dolar standard formatted : " + usFormatted);
customFormat = MonetaryFormats.getAmountFormat(AmountFormatQueryBuilder.of(Locale.US).set(CurrencyStyle.NAME).set("pattern", "00000.00 <EFBFBD>").build());
customFormat = MonetaryFormats.getAmountFormat(AmountFormatQueryBuilder.of(Locale.US).set(CurrencyStyle.NAME).set("pattern", "00000.00 ¤").build());
customFormatted = customFormat.format(oneDolar);
LOGGER.info("One dolar custom formatted : " + customFormatted);
}