* @param decimalPlaces
     * @param a_RoundingMode
     * @return x rounded if necessary and with a scale set to decimalPlaces
     */
    public static BigDecimal roundToAndSetDecimalPlaces(
            BigDecimal x,
            int decimalPlaces,
            RoundingMode a_RoundingMode) {
        BigDecimal result;
        int xScale = x.scale();
        if (xScale > decimalPlaces) {
            result = x.setScale(decimalPlaces, a_RoundingMode);
            return result;
        }
        result = x.setScale(decimalPlaces);
        return result;
    }