code: public BigDecimal divide(BigDecimal divisor, int scale, int roundingMode) {
          if (roundingMode < ROUND_UP || roundingMode > ROUND_UNNECESSARY)
              throw new IllegalArgumentException("Invalid rounding mode");
          if (this.intCompact != INFLATED) {
              if ((divisor.intCompact != INFLATED)) {
                  return divide(this.intCompact, this.scale, divisor.intCompact, divisor.scale, scale, roundingMode);
              } else {
                  return divide(this.intCompact, this.scale, divisor.intVal, divisor.scale, scale, roundingMode);
              }
          } else {
              if ((divisor.intCompact != INFLATED)) {
                  return divide(this.intVal, this.scale, divisor.intCompact, divisor.scale, scale, roundingMode);
              } else {
                  return divide(this.intVal, this.scale, divisor.intVal, divisor.scale, scale, roundingMode);
              }
          }
      }
docs: Returns a {@code BigDecimal} whose value is {@code (this /
  divisor)}, and whose scale is as specified.  If rounding must
  be performed to generate a result with the specified scale, the
  specified rounding mode is applied.
  
  <p>The new {@link #divide(BigDecimal, int, RoundingMode)} method
  should be used in preference to this legacy method.
  
  @param  divisor value by which this {@code BigDecimal} is to be divided.
  @param  scale scale of the {@code BigDecimal} quotient to be returned.
  @param  roundingMode rounding mode to apply.
  @return {@code this / divisor}
  @throws ArithmeticException if {@code divisor} is zero,
  {@code roundingMode==ROUND_UNNECESSARY} and
  the specified scale is insufficient to represent the result
  of the division exactly.
  @throws IllegalArgumentException if {@code roundingMode} does not
  represent a valid rounding mode.
  @see    #ROUND_UP
  @see    #ROUND_DOWN
  @see    #ROUND_CEILING
  @see    #ROUND_FLOOR
  @see    #ROUND_HALF_UP
  @see    #ROUND_HALF_DOWN
  @see    #ROUND_HALF_EVEN
  @see    #ROUND_UNNECESSARY