class FeatureBinsUtil {

    public static Double keepGivenDecimal(Double d, int decimal) {
        if (null == d) {
            return null;
        }
        BigDecimal bigDecimal = new BigDecimal(d);

        return bigDecimal.setScale(decimal, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

}