本文整理汇总了Java中javax.money.MonetaryAmount.multiply方法的典型用法代码示例。如果您正苦于以下问题:Java MonetaryAmount.multiply方法的具体用法?Java MonetaryAmount.multiply怎么用?Java MonetaryAmount.multiply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.money.MonetaryAmount
的用法示例。
在下文中一共展示了MonetaryAmount.multiply方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.money.MonetaryAmount; //导入方法依赖的package包/类
public static void main(String[] args) {
CurrencyUnit currency = Monetary.getCurrency("BRL");
MonetaryAmount money = Money.of(100, currency);
Number number = 20;
MonetaryAmount divideResult = money.divide(number);//BRL 5
MonetaryAmount remainderResult = money.remainder(30);//BRL 10
MonetaryAmount resultMultiply = money.multiply(5);//BRL 500
}
示例2: apply
import javax.money.MonetaryAmount; //导入方法依赖的package包/类
/**
* Gets the percentage of the amount.
* <p>
* This returns the monetary amount in percent. For example, for 10% 'EUR
* 2.35' will return 0.235.
* <p>
* This is returned as a {@code MonetaryAmount}.
*
* @return the percent result of the amount, never {@code null}
*/
@Override
public MonetaryAmount apply(MonetaryAmount amount) {
Objects.requireNonNull(amount, "Amount required.");
return amount.multiply(percentValue);
}
示例3: apply
import javax.money.MonetaryAmount; //导入方法依赖的package包/类
/**
* Gets the permil of the amount.
* <p>
* This returns the monetary amount in permil. For example, for 10% 'EUR
* 2.35' will return 0.235.
* <p>
* This is returned as a {@code MonetaryAmount}.
*
* @return the permil result of the amount, never {@code null}
*/
@Override
public MonetaryAmount apply(MonetaryAmount amount) {
Objects.requireNonNull(amount, "Amount required.");
return amount.multiply(permilValue);
}