public BigDecimal divide (BigDecimal divisor, int roundingMode)

Returns a BigDecimal whose value is (this / divisor), and whose scale is this.scale(). If rounding must be performed to generate a result with the given scale, the specified rounding mode is applied.

The new divide(BigDecimal, RoundingMode) method should be used in preference to this legacy method.

Parameters:
divisor    value by which this BigDecimal is to be divided.
roundingMode    rounding mode to apply.

Returns:  this / divisor

Exceptions:
ArithmeticException    if divisor==0, or roundingMode==ROUND_UNNECESSARY and this.scale() is insufficient to represent the result of the division exactly.
IllegalArgumentException    if roundingMode does not represent a valid rounding mode.

See also:
ROUND_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR, ROUND_HALF_UP, ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_UNNECESSARY