Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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) {
        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);
    }
}