Given a price-point represented as an integer of whole cents, i.e. 199 = $1.99
, is there an API method for constructing a MonetaryAmount
?
One simple method would be to divide the amount by 100, but wondering if there's an API method for this.
MonetaryAmount ma = Money.of(199, "NZD").divide(100);
The Money.ofMinor() method is exactly what you are looking for.
Obtains an instance of
Money
from an amount in minor units.
For example,ofMinor(USD, 1234, 2)
creates the instanceUSD 12.34
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With