*** 1534,1544 **** * 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. --- 1534,1544 ---- * 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. * ! * @deprecated The method {@link #divide(BigDecimal, int, RoundingMode)} * 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.

*** 1556,1565 **** --- 1556,1566 ---- * @see #ROUND_HALF_UP * @see #ROUND_HALF_DOWN * @see #ROUND_HALF_EVEN * @see #ROUND_UNNECESSARY */ + @Deprecated(since="9") 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)) {

*** 1600,1610 **** * Returns a {@code BigDecimal} whose value is {@code (this / * divisor)}, and whose scale is {@code this.scale()}. If * rounding must be performed to generate a result with the given * scale, the specified rounding mode is applied. * ! * <p>The new {@link #divide(BigDecimal, RoundingMode)} method * should be used in preference to this legacy method. * * @param divisor value by which this {@code BigDecimal} is to be divided. * @param roundingMode rounding mode to apply. * @return {@code this / divisor} --- 1601,1611 ---- * Returns a {@code BigDecimal} whose value is {@code (this / * divisor)}, and whose scale is {@code this.scale()}. If * rounding must be performed to generate a result with the given * scale, the specified rounding mode is applied. * ! * @deprecated The method {@link #divide(BigDecimal, RoundingMode)} * should be used in preference to this legacy method. * * @param divisor value by which this {@code BigDecimal} is to be divided. * @param roundingMode rounding mode to apply. * @return {@code this / divisor}

*** 1621,1630 **** --- 1622,1632 ---- * @see #ROUND_HALF_UP * @see #ROUND_HALF_DOWN * @see #ROUND_HALF_EVEN * @see #ROUND_UNNECESSARY */ + @Deprecated(since="9") public BigDecimal divide(BigDecimal divisor, int roundingMode) { return this.divide(divisor, scale, roundingMode); } /**

*** 2265,2319 **** --- 2267,2339 ---- /** * Rounding mode to round away from zero. Always increments the * digit prior to a nonzero discarded fraction. Note that this rounding * mode never decreases the magnitude of the calculated value. + * + * @deprecated Use {@link RoundingMode#UP} instead. */ + @Deprecated(since="9") public static final int ROUND_UP = 0; /** * Rounding mode to round towards zero. Never increments the digit * prior to a discarded fraction (i.e., truncates). Note that this * rounding mode never increases the magnitude of the calculated value. + * + * @deprecated Use {@link RoundingMode#DOWN} instead. */ + @Deprecated(since="9") public static final int ROUND_DOWN = 1; /** * Rounding mode to round towards positive infinity. If the * {@code BigDecimal} is positive, behaves as for * {@code ROUND_UP}; if negative, behaves as for * {@code ROUND_DOWN}. Note that this rounding mode never * decreases the calculated value. + * + * @deprecated Use {@link RoundingMode#CEILING} instead. */ + @Deprecated(since="9") public static final int ROUND_CEILING = 2; /** * Rounding mode to round towards negative infinity. If the * {@code BigDecimal} is positive, behave as for * {@code ROUND_DOWN}; if negative, behave as for * {@code ROUND_UP}. Note that this rounding mode never * increases the calculated value. + * + * @deprecated Use {@link RoundingMode#FLOOR} instead. */ + @Deprecated(since="9") public static final int ROUND_FLOOR = 3; /** * Rounding mode to round towards {@literal "nearest neighbor"} * unless both neighbors are equidistant, in which case round up. * Behaves as for {@code ROUND_UP} if the discarded fraction is * ≥ 0.5; otherwise, behaves as for {@code ROUND_DOWN}. Note * that this is the rounding mode that most of us were taught in * grade school. + * + * @deprecated Use {@link RoundingMode#HALF_UP} instead. */ + @Deprecated(since="9") public static final int ROUND_HALF_UP = 4; /** * Rounding mode to round towards {@literal "nearest neighbor"} * unless both neighbors are equidistant, in which case round * down. Behaves as for {@code ROUND_UP} if the discarded * fraction is {@literal >} 0.5; otherwise, behaves as for * {@code ROUND_DOWN}. + * + * @deprecated Use {@link RoundingMode#HALF_DOWN} instead. */ + @Deprecated(since="9") public static final int ROUND_HALF_DOWN = 5; /** * Rounding mode to round towards the {@literal "nearest neighbor"} * unless both neighbors are equidistant, in which case, round

*** 2321,2339 **** --- 2341,2365 ---- * {@code ROUND_HALF_UP} if the digit to the left of the * discarded fraction is odd; behaves as for * {@code ROUND_HALF_DOWN} if it's even. Note that this is the * rounding mode that minimizes cumulative error when applied * repeatedly over a sequence of calculations. + * + * @deprecated Use {@link RoundingMode#HALF_EVEN} instead. */ + @Deprecated(since="9") public static final int ROUND_HALF_EVEN = 6; /** * Rounding mode to assert that the requested operation has an exact * result, hence no rounding is necessary. If this rounding mode is * specified on an operation that yields an inexact result, an * {@code ArithmeticException} is thrown. + * + * @deprecated Use {@link RoundingMode#UNNECESSARY} instead. */ + @Deprecated(since="9") public static final int ROUND_UNNECESSARY = 7; // Scaling/Rounding Operations

*** 2406,2416 **** * modified, contrary to the usual convention of having methods * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>. * Instead, {@code setScale} returns an object with the proper * scale; the returned object may or may not be newly allocated. * ! * <p>The new {@link #setScale(int, RoundingMode)} method should * be used in preference to this legacy method. * * @param newScale scale of the {@code BigDecimal} value to be returned. * @param roundingMode The rounding mode to apply. * @return a {@code BigDecimal} whose scale is the specified value, --- 2432,2442 ---- * modified, contrary to the usual convention of having methods * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>. * Instead, {@code setScale} returns an object with the proper * scale; the returned object may or may not be newly allocated. * ! * @deprecated The method {@link #setScale(int, RoundingMode)} should * be used in preference to this legacy method. * * @param newScale scale of the {@code BigDecimal} value to be returned. * @param roundingMode The rounding mode to apply. * @return a {@code BigDecimal} whose scale is the specified value,

*** 2429,2438 **** --- 2455,2465 ---- * @see #ROUND_HALF_UP * @see #ROUND_HALF_DOWN * @see #ROUND_HALF_EVEN * @see #ROUND_UNNECESSARY */ + @Deprecated(since="9") public BigDecimal setScale(int newScale, int roundingMode) { if (roundingMode < ROUND_UP || roundingMode > ROUND_UNNECESSARY) throw new IllegalArgumentException("Invalid rounding mode"); int oldScale = this.scale;