Java BigDecimal Add add(BigDecimal number1, BigDecimal number2, int decimalPlaces)

Here you can find the source of add(BigDecimal number1, BigDecimal number2, int decimalPlaces)

Description

add

License

Apache License

Declaration

private static BigDecimal add(BigDecimal number1, BigDecimal number2, int decimalPlaces) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

public class Main {
    private static final MathContext mathContext = MathContext.DECIMAL128;
    private static final RoundingMode roundingMode = RoundingMode.HALF_UP;

    private static BigDecimal add(BigDecimal number1, BigDecimal number2, int decimalPlaces) {
        return number1.add(number2, mathContext).setScale(decimalPlaces, roundingMode);
    }// w  w w  .  j  a v  a 2  s . c om
}

Related

  1. add(BigDecimal a, BigDecimal b)
  2. add(BigDecimal aValue1, BigDecimal aValue2)
  3. add(BigDecimal bigDecimal, BigDecimal bigDecimal2)
  4. add(BigDecimal left, BigDecimal right)
  5. add(BigDecimal num1, BigDecimal num2)
  6. add(BigDecimal obj1, BigDecimal obj2)
  7. add(BigDecimal one, BigDecimal another)
  8. add(BigDecimal value1, BigDecimal value2)
  9. add(BigDecimal... operands)