Code example for BigInteger

Methods: divide

        int calcBase = findCalculationBase( op1, op2);
        switch (calcBase) {
            case BASE_BIGINTEGER:
                BigInteger b1 = toBigInteger( op1 );
                BigInteger b2 = toBigInteger( op2 );
                return b1.divide( b2);
            case BASE_LONG:
                long l1 = op1.longValue();
                long l2 = op2.longValue();
                return wrapPrimitive( l1 / l2, op1, op2);
            case BASE_FLOAT:
                return new Float (op1.floatValue()/op2.floatValue());
            case BASE_DOUBLE:
                return new Double (op1.doubleValue()/op2.doubleValue());
            // Default is BigDecimal operation 
                return toBigDecimal( op1 ).divide( toBigDecimal( op2 ), BigDecimal.ROUND_HALF_DOWN);
Connect your IDE to all the code out there  Get Codota for Java