class NumericFunctions {

    public static Float truncate(Float inputValue, int numberOfDigits) {
        if (inputValue == null)
            return null;
        BigDecimal bigDecimal = new BigDecimal(inputValue);
        BigDecimal roundedWithScale = bigDecimal.setScale(numberOfDigits, RoundingMode.DOWN).stripTrailingZeros();
        return roundedWithScale.floatValue();
    }

}