Here you can find the source of subtractVatAmount(BigDecimal percentage, BigDecimal amount)
public static BigDecimal subtractVatAmount(BigDecimal percentage, BigDecimal amount)
//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); } }