package com.ypsx.yppos.utils;

import java.math.BigDecimal;

public class BigDecimalUtils {

    public static double forPlus(double amount) {
        BigDecimal bigDecimal = new BigDecimal(amount);
        BigDecimal result = null;
        result = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
        return result.doubleValue();
    }

    public static double forPlus2(double amount) {
        BigDecimal bigDecimal = new BigDecimal(amount);
        BigDecimal result = null;
        result = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
        return result.stripTrailingZeros().doubleValue();
    }
}
