0

I want to convert Joda.Money to pennies. Is there any Joda library method available?

Sample input:

USD 233.33

Sample output:

23333

Tried below 2 options:

  1. tried with Money.getAmountMinorInt() and it's returning with multiplies of 100.
  2. getAmount * 100

not sure using getAmountMinorInt is correct.

Which way of converting is correct or any other library method available to convert it?

Remo
  • 534
  • 7
  • 26
  • 1
    What is wrong with [getAmountMinor](https://www.joda.org/joda-money/apidocs/org.joda.money/org/joda/money/Money.html#getAmountMinor())? – matt Jul 28 '23 at 07:26
  • 1
    `.getAmountMinorInt()` seems to be what you are looking for. The method returns the minor units of the currency. For USD, that is pennies. – ODDminus1 Jul 28 '23 at 07:29
  • `...and it's returning with multiplies of 100.` Maybe you should include an example and how the input is incorrect. The getAmountMinor methods seem to be exactly what you're looking for. – matt Jul 28 '23 at 07:31

0 Answers0