Java BigDecimal Subtract subtract(BigDecimal bigDecimal, BigDecimal bigDecimal2)

Here you can find the source of subtract(BigDecimal bigDecimal, BigDecimal bigDecimal2)

Description

subtract

License

Apache License

Declaration

public static BigDecimal subtract(BigDecimal bigDecimal, BigDecimal bigDecimal2) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {

    public static BigDecimal subtract(BigDecimal bigDecimal, BigDecimal bigDecimal2) {
        if (bigDecimal == null && bigDecimal2 == null) {
            return zeroBigDecimal();
        }//from   w  w  w  .j a v  a2s  .  c om
        if (bigDecimal == null) {
            return bigDecimal2;
        }
        if (bigDecimal2 == null) {
            return bigDecimal;
        }
        return bigDecimal.subtract(bigDecimal2);
    }

    public static BigDecimal zeroBigDecimal() {
        return new BigDecimal("0.00");
    }
}

Related

  1. sub(BigDecimal v1, BigDecimal v2)
  2. subtract(BigDecimal a, BigDecimal b)
  3. subtract(BigDecimal a, BigDecimal b)
  4. subtract(BigDecimal amount, BigDecimal subtrahend, int scale)
  5. subtract(BigDecimal aValue1, BigDecimal aValue2)
  6. subtract(BigDecimal left, BigDecimal right)
  7. subtract(BigDecimal minuend, BigDecimal subtrahend)
  8. subtract(BigDecimal num1, BigDecimal num2)
  9. subtract(BigDecimal number1, BigDecimal number2, int decimalPlaces)