public static BigDecimal divideNoRounding(
            BigInteger x,
            BigDecimal y) {
        // 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 new BigDecimal(x.toString());
        }
        BigDecimal x_BigDecimal = new BigDecimal(x);
        if (x_BigDecimal.compareTo(y) == 0) {
            return BigDecimal.ONE;
        }
        return divideNoCaseCheckNoRounding(
                x_BigDecimal,
                y);
    }