public static BigDecimal divideRoundToFixedDecimalPlaces(
            BigInteger x,
            BigDecimal y,
            int decimalPlaces,
            RoundingMode a_RoundingMode) {
        // Deal with special cases
        if (x.compareTo(BigInteger.ZERO) == 0) {
            return BigDecimal.ZERO;
        }
        if (y.compareTo(BigDecimal.ZERO) == 0) {
            throw new ArithmeticException("Attempted division by zero...");
        }
        if (y.compareTo(BigDecimal.ONE) == 0) {
            return roundToAndSetDecimalPlaces(
                    new BigDecimal(x), decimalPlaces, a_RoundingMode);
        }
        BigDecimal x_BigDecimal = new BigDecimal(x);
        if (x_BigDecimal.compareTo(y) == 0) {
            return BigDecimal.ONE.setScale(decimalPlaces);
        }
        BigDecimal result = divideNoCaseCheckRoundIfNecessary(
                x_BigDecimal,
                y,
                decimalPlaces,
                a_RoundingMode);
        return roundToAndSetDecimalPlaces(result, decimalPlaces, a_RoundingMode);
    }