Java BigDecimal Add addBigDecimal(BigDecimal a, BigDecimal b)

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

Description

add Big Decimal

License

Open Source License

Declaration

public static BigDecimal addBigDecimal(BigDecimal a, BigDecimal b) 

Method Source Code

//package com.java2s;
/**// w  ww  . ja  v  a2 s  . c  om
 * Copyright (c) 2014 Baidu, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.math.BigDecimal;

public class Main {

    public static BigDecimal addBigDecimal(BigDecimal a, BigDecimal b) {
        if (a == null) {
            return b;
        } else if (b == null) {
            return a;
        } else {
            return a.add(b);
        }
    }
}

Related

  1. add(final BigDecimal start, final BigDecimal... values)
  2. add(final BigDecimal v1, final BigDecimal v2)
  3. add(Vector a, Vector b)
  4. add2Abs(BigDecimal aValue1, BigDecimal aValue2)
  5. addBigDec(BigDecimal b1, BigDecimal b2)
  6. addBigDecimals(String value1, String value2)
  7. addBigDecimalsInMap(Map baseMap, Map addMap)
  8. addPercent(BigDecimal price, double amount)
  9. addQtde(BigDecimal val1, BigDecimal val2)