Java BigDecimal Add add(BigDecimal a, BigDecimal b)

Here you can find the source of add(BigDecimal a, BigDecimal b)

Description

Null safe convenience method for adding two BigDecimal objects.

License

Open Source License

Parameter

Parameter Description
a big decimal two
b big decimal one

Return

sum of the two big decimals

Declaration

private static BigDecimal add(BigDecimal a, BigDecimal b) 

Method Source Code

//package com.java2s;
import java.math.BigDecimal;

public class Main {
    /**// www .ja va  2  s. co  m
     * Null safe convenience method for adding two BigDecimal objects.
     *
     * @param a big decimal two
     * @param b big decimal one
     * @return sum of the two big decimals
     */
    private static BigDecimal add(BigDecimal a, BigDecimal b) {
        if (a == null)
            return b;
        if (b == null)
            return a;

        return a.add(b);
    }
}

Related

  1. add(BigDecimal a, BigDecimal b)
  2. add(BigDecimal a, BigDecimal b)
  3. add(BigDecimal aValue1, BigDecimal aValue2)
  4. add(BigDecimal bigDecimal, BigDecimal bigDecimal2)
  5. add(BigDecimal left, BigDecimal right)
  6. add(BigDecimal num1, BigDecimal num2)