class MoneyUtils {

    public static BigDecimal getTaxAmount(final BigDecimal money, final BigDecimal taxRate, final boolean taxIncluded) {
        if (money == null || taxRate == null) {
            return Total.ZERO;
        }
        if (taxIncluded) {
            // vat = item * vatRate / (vat + 100). Round CEILING to make sure we are not underpaying tax
            return money.multiply(taxRate)
                    .divide(taxRate.add(HUNDRED), Constants.MONEY_SCALE, BigDecimal.ROUND_CEILING);
        }
        // tax = item * taxRate / 100. Round CEILING to make sure we are not underpaying tax
        return money.multiply(taxRate).divide(HUNDRED, Constants.MONEY_SCALE, BigDecimal.ROUND_CEILING);
    }

    private  MoneyUtils();

}