Java BigDecimal Subtract subtractVatAmount(BigDecimal percentage, BigDecimal amount)

Here you can find the source of subtractVatAmount(BigDecimal percentage, BigDecimal amount)

Description

subtract Vat Amount

License

Open Source License

Declaration

public static BigDecimal subtractVatAmount(BigDecimal percentage,
            BigDecimal amount) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static final BigDecimal HUNDRED = new BigDecimal("100");

    public static BigDecimal subtractVatAmount(BigDecimal percentage,
            BigDecimal amount) {//from   ww w  . j  av a  2 s.c o m
        BigDecimal f = BigDecimal.ONE.subtract(BigDecimal.ONE.divide(
                percentage.add(HUNDRED).divide(HUNDRED), 14,
                RoundingMode.HALF_UP));
        return amount.multiply(f).setScale(2, RoundingMode.HALF_UP);
    }
}

Related

  1. subtract(float a, BigDecimal b_bd)
  2. subtract(Vector a, Vector b)
  3. subtract2Abs(BigDecimal aValue1, BigDecimal aValue2)
  4. subtractPercent(BigDecimal price, double amount)
  5. subtractQtde(BigDecimal val1, BigDecimal val2)
  6. subUlp(BigDecimal x)