src/java.base/share/classes/java/text/DigitList.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 47216 71c04702a3d5
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   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      * @exception 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) {