public static Money of(BigMoneyProvider moneyProvider, RoundingMode roundingMode) {
        MoneyUtils.checkNotNull(moneyProvider, "BigMoneyProvider must not be null");
        MoneyUtils.checkNotNull(roundingMode, "RoundingMode must not be null");
        return new Money(BigMoney.of(moneyProvider).withCurrencyScale(roundingMode));
    }
public static Money of ( BigMoneyProvider moneyProvider , RoundingMode roundingMode ) { MoneyUtils . checkNotNull ( moneyProvider , "BigMoneyProvider must not be null" ) ; MoneyUtils . checkNotNull ( roundingMode , "RoundingMode must not be null" ) ; return new Money ( BigMoney . of ( moneyProvider ) . withCurrencyScale ( roundingMode ) ) ; }
Obtains an instance of {@code Money} from a provider, rounding as necessary.
<p>
This allows you to create an instance from any class that implements the
provider, such as {@code BigMoney}.
The rounding mode is used to adjust the scale to the scale of the currency.

@param moneyProvider  the money to convert, not null
@param roundingMode  the rounding mode to use, not null
@return the new instance, never null
@throws ArithmeticException if the rounding fails