public static enum NumberFormatter.RoundingPriority extends Enum<NumberFormatter.RoundingPriority>
There are two modes, RELAXED and STRICT:
The default settings for compact notation rounding are Max-Fraction = 0 (round to the nearest integer), Max-Significant = 2 (round to 2 significant digits), and priority RELAXED (choose the constraint that results in more digits being displayed).
Conflicting *minimum* fraction and significant digits are always resolved in the direction that results in more trailing zeros.
Example 1: Consider the number 3.141, with various different settings:
The rounding priority determines how to resolve the conflict when both Max-Fraction and Max-Significant are set. With RELAXED, the less-strict setting (the one that causes more digits to be displayed) will be used; Max-Significant wins. With STRICT, the more-strict setting (the one that causes fewer digits to be displayed) will be used; Max-Fraction wins.
Example 2: Consider the number 8317, with various different settings:
Here, RELAXED favors Max-Fraction and STRICT favors Max-Significant. Note that this larger number caused the two modes to favor the opposite result.
|Enum Constant and Description|
Favor greater precision by relaxing one of the rounding constraints.
Favor adherence to all rounding constraints by producing lower precision.
|Modifier and Type||Method and Description|
Returns the enum constant of this type with the specified name.
Returns an array containing the constants of this enum type, in the order they are declared.
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
public static final NumberFormatter.RoundingPriority RELAXED
public static final NumberFormatter.RoundingPriority STRICT
public static NumberFormatter.RoundingPriority values()
for (NumberFormatter.RoundingPriority c : NumberFormatter.RoundingPriority.values()) System.out.println(c);
public static NumberFormatter.RoundingPriority valueOf(String name)
Copyright © 2016 Unicode, Inc. and others.