Class MonetaryFormat

Utility for formatting and parsing coin values to and from human readable form.

MonetaryFormat instances are immutable. Invoking a configuration method has no effect on the receiving instance; you
must store and use the new instance it returns, instead. Instances are thread safe, so they may be stored safely as
static constants.

minDecimals

Set minimum number of decimals to use for formatting. If the value precision exceeds all decimals specified
(including additional decimals specified by optionalDecimals(int...) or
repeatOptionalDecimals(int, int)), the value will be rounded. This configuration is not relevant for
parsing.

optionalDecimals

Set additional groups of decimals to use after the minimum decimals, if they are useful for expressing precision.
Each value is a number of decimals in that group. If the value precision exceeds all decimals specified
(including minimum decimals), the value will be rounded. This configuration is not relevant for parsing.

For example, if you pass 4,2 it will add four decimals to your formatted string if needed, and then add
another two decimals if needed. At this point, rather than adding further decimals the value will be rounded.

Parameters:

groups - any number numbers of decimals, one for each group

repeatOptionalDecimals

Set repeated additional groups of decimals to use after the minimum decimals, if they are useful for expressing
precision. If the value precision exceeds all decimals specified (including minimum decimals), the value will be
rounded. This configuration is not relevant for parsing.

For example, if you pass 1,8 it will up to eight decimals to your formatted string if needed. After
these have been used up, rather than adding further decimals the value will be rounded.