Java Utililty Methods BigDecimal Add

List of utility methods to do BigDecimal Add

Description

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

Method

BigDecimaladd(BigDecimal value1, BigDecimal value2)
add
if (value1 != null && value2 != null) {
    return value1.add(value2);
if (value1 != null) {
    return value1;
if (value2 != null) {
    return value2;
...
BigDecimaladd(BigDecimal... operands)
Returns the sum of all the given decimals.
BigDecimal result = null;
if (operands != null) {
    for (BigDecimal operand : operands) {
        if (operand != null) {
            if (result == null) {
                result = operand;
            } else {
                result = result.add(operand);
...
BigDecimal[]add(BigDecimal[] item1, BigDecimal[] item2)
add
for (int i = 0; i < item1.length; i++) {
    item1[i] = item1[i].add(item2[i]);
return item1;
BigDecimaladd(final BigDecimal baseAmount, final BigDecimal amountToAdd)
Adds two amounts rounding to two decimal places.
return rounded(baseAmount).add(rounded(amountToAdd));
BigDecimaladd(final BigDecimal start, final BigDecimal... values)
Add n BigDecimal safely (i.e.
BigDecimal total = start != null ? start : BigDecimal.ZERO;
if (values != null) {
    for (final BigDecimal v : values) {
        total = doAdd(total, v);
return total;
BigDecimaladd(final BigDecimal v1, final BigDecimal v2)
add
if (v1 == null) {
    if (v2 == null) {
        return BigDecimal.ZERO;
    } else {
        return v2;
} else {
    if (v2 == null) {
...
Vectoradd(Vector a, Vector b)
add
int m = a.size();
Vector<BigDecimal> c = new Vector(m);
for (int i = 0; i < m; i++) {
    BigDecimal value = ((BigDecimal) a.elementAt(i)).add((BigDecimal) b.elementAt(i));
    c.add(value);
return c;
BigDecimaladd2Abs(BigDecimal aValue1, BigDecimal aValue2)
add Abs
if (aValue1 == null || aValue2 == null)
    return null;
return aValue1.add(aValue2).abs();
BigDecimaladdBigDec(BigDecimal b1, BigDecimal b2)
add Big Dec
return b1.add(b2);
BigDecimaladdBigDecimal(BigDecimal a, BigDecimal b)
add Big Decimal
if (a == null) {
    return b;
} else if (b == null) {
    return a;
} else {
    return a.add(b);