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

BigDecimalsub(BigDecimal b1, BigDecimal b2)
Substract @param b1 with @param b2
if (b1 == null && b2 == null) {
    return null;
if (b1 == null) {
    b1 = new BigDecimal(0);
if (b2 == null) {
    b2 = new BigDecimal(0);
...
BigDecimalsub(BigDecimal d1, BigDecimal d2)
sub
return d1.subtract(d2);
BigDecimalsub(BigDecimal v1, BigDecimal v2)
sub
v1 = v1 == null ? BigDecimal.ZERO : v1;
v2 = v2 == null ? BigDecimal.ZERO : v2;
return v1.subtract(v2);
BigDecimalsub(BigDecimal v1, BigDecimal v2)
sub
BigDecimal b1 = new BigDecimal("0");
if (v1 != null) {
    b1 = new BigDecimal(Double.toString(v1.doubleValue()));
BigDecimal b2 = new BigDecimal("0");
if (v2 != null) {
    b2 = new BigDecimal(Double.toString(v2.doubleValue()));
return b1.subtract(b2);
BigDecimalsubtract(BigDecimal a, BigDecimal b)
subtract
if (a == null)
    a = new BigDecimal("0.00");
if (b == null)
    b = new BigDecimal("0.00");
return a.subtract(b).setScale(2);
BigDecimalsubtract(BigDecimal a, BigDecimal b)
subtract
return a.subtract(b).setScale(scale, RoundingMode.HALF_UP);
BigDecimalsubtract(BigDecimal amount, BigDecimal subtrahend, int scale)
subtract
return roundBigDecimal(amount.subtract(subtrahend), scale);
BigDecimalsubtract(BigDecimal aValue1, BigDecimal aValue2)
subtract
if (aValue1 == null || aValue2 == null)
    return null;
return aValue1.subtract(aValue2);
BigDecimalsubtract(BigDecimal bigDecimal, BigDecimal bigDecimal2)
subtract
if (bigDecimal == null && bigDecimal2 == null) {
    return zeroBigDecimal();
if (bigDecimal == null) {
    return bigDecimal2;
if (bigDecimal2 == null) {
    return bigDecimal;
...
BigDecimalsubtract(BigDecimal left, BigDecimal right)
subtract
try {
    return left.subtract(right, MathContext.UNLIMITED);
} catch (ArithmeticException ex) {
    return left.subtract(right, MathContext.DECIMAL128);