Java BigDecimal Subtract subtract(BigDecimal number1, BigDecimal number2, int decimalPlaces)

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

Description

subtract

License

Apache License

Declaration

private static BigDecimal subtract(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 subtract(BigDecimal number1, BigDecimal number2, int decimalPlaces) {
        return number1.subtract(number2, mathContext).setScale(decimalPlaces, roundingMode);
    }//from w  w  w  .ja  va2s .c  o m
}

Related

  1. subtract(BigDecimal aValue1, BigDecimal aValue2)
  2. subtract(BigDecimal bigDecimal, BigDecimal bigDecimal2)
  3. subtract(BigDecimal left, BigDecimal right)
  4. subtract(BigDecimal minuend, BigDecimal subtrahend)
  5. subtract(BigDecimal num1, BigDecimal num2)
  6. subtract(BigDecimal one, BigDecimal another)
  7. subtract(BigDecimal v1, BigDecimal v2)
  8. subtract(final BigDecimal baseAmount, final BigDecimal amountToSubtract)
  9. subtract(final BigDecimal start, final BigDecimal... values)