1

所以这里的问题是:为什么这样:

Monetary.of(new BigDecimal("100.00"), "EUR") 

打印“EUR 1E+2”,但任何其他小数 != .00 将打印正确:

Monetary.of(new BigDecimal("100.01"), "EUR") 

“100.01 欧元”???

4

1 回答 1

1

好的,

它看起来像调用 toString( )MonetaryAmount将调用engineeringString. BigDecimal打印 a 的正确方法MonetaryAmount是格式化它:

MonetaryFormats.getAmountFormat(Locale.getDefault()).format(Money.of(source.getValue(), source.getCurrency().getUid()))
于 2016-03-07T22:05:33.973 回答