Java Utililty Methods BigDecimal Subtract

List of utility methods to do BigDecimal Subtract

Description

The list of methods to do BigDecimal Subtract are organized into topic(s).

Method

BigDecimalsubtractPercent(BigDecimal price, double amount)
subtract Percent
return price.subtract(getPercentageValue(price, amount));
BigDecimalsubtractQtde(BigDecimal val1, BigDecimal val2)
subtract Qtde
BigDecimal aux = val1;
aux = aux.setScale(decQtde, roundingMode);
return aux.subtract(val2).setScale(decQtde, roundingMode);
BigDecimalsubtractVatAmount(BigDecimal percentage, BigDecimal amount)
subtract Vat Amount
BigDecimal f = BigDecimal.ONE
        .subtract(BigDecimal.ONE.divide(percentage.add(HUNDRED).divide(HUNDRED), 14, RoundingMode.HALF_UP));
return amount.multiply(f).setScale(2, RoundingMode.HALF_UP);
BigDecimalsubUlp(BigDecimal x)
sub Ulp
BigInteger unscaledValue = x.unscaledValue();
unscaledValue = unscaledValue.subtract(BigInteger.ONE);
return new BigDecimal(unscaledValue, x.scale());