437 * of digits will result in an increment to the last digit. This |
437 * of digits will result in an increment to the last digit. This |
438 * method implements the rounding modes defined in the |
438 * method implements the rounding modes defined in the |
439 * java.math.RoundingMode class. |
439 * java.math.RoundingMode class. |
440 * [bnf] |
440 * [bnf] |
441 * @param maximumDigits the number of digits to keep, from 0 to |
441 * @param maximumDigits the number of digits to keep, from 0 to |
442 * <code>count-1</code>. If 0, then all digits are rounded away, and |
442 * {@code count-1}. If 0, then all digits are rounded away, and |
443 * this method returns true if a one should be generated (e.g., formatting |
443 * this method returns true if a one should be generated (e.g., formatting |
444 * 0.09 with "#.#"). |
444 * 0.09 with "#.#"). |
445 * @param alreadyRounded whether or not rounding up has already happened. |
445 * @param alreadyRounded whether or not rounding up has already happened. |
446 * @param valueExactAsDecimal whether or not collected digits provide |
446 * @param valueExactAsDecimal whether or not collected digits provide |
447 * an exact decimal representation of the value. |
447 * an exact decimal representation of the value. |
448 * @throws ArithmeticException if rounding is needed with rounding |
448 * @throws ArithmeticException if rounding is needed with rounding |
449 * mode being set to RoundingMode.UNNECESSARY |
449 * mode being set to RoundingMode.UNNECESSARY |
450 * @return true if digit <code>maximumDigits-1</code> should be |
450 * @return true if digit {@code maximumDigits-1} should be |
451 * incremented |
451 * incremented |
452 */ |
452 */ |
453 private boolean shouldRoundUp(int maximumDigits, |
453 private boolean shouldRoundUp(int maximumDigits, |
454 boolean alreadyRounded, |
454 boolean alreadyRounded, |
455 boolean valueExactAsDecimal) { |
455 boolean valueExactAsDecimal) { |