GeezerVison is showing docs.oracle.com — ChoiceFormat (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.text
Class ChoiceFormat
-
-
Constructor Summary
Constructors
| Constructor |
Description |
ChoiceFormat(double[] limits,
String[] formats) |
Constructs with the limits and the corresponding formats.
|
ChoiceFormat(String newPattern) |
Constructs with limits and corresponding formats based on the pattern.
|
-
Method Summary
-
Methods inherited from class java.text.NumberFormat
format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
-
-
Constructor Detail
-
ChoiceFormat
public ChoiceFormat(double[] limits,
String[] formats)
Constructs with the limits and the corresponding formats.
- Parameters:
limits - limits in ascending order
formats - corresponding format strings
- See Also:
setChoices(double[], java.lang.String[])
-
Method Detail
-
format
public StringBuffer format(long number,
StringBuffer toAppendTo,
FieldPosition status)
Specialization of format. This method really calls
format(double, StringBuffer, FieldPosition)
thus the range of longs that are supported is only equal to
the range that can be stored by double. This will never be
a practical limitation.
- Specified by:
format in class NumberFormat
- Parameters:
number - the long number to format
toAppendTo - the StringBuffer to which the formatted text is to be
appended
status - the field position
- Returns:
- the formatted StringBuffer
- See Also:
Format.format(java.lang.Object)
-
previousDouble
public static final double previousDouble(double d)
Finds the greatest double less than d.
If NaN, returns same value.
- Parameters:
d - the reference value
- Returns:
- the greatest double value less than
d
- See Also:
nextDouble(double)
-
nextDouble
public static double nextDouble(double d,
boolean positive)
Finds the least double greater than d (if positive is
true), or the greatest double less than d (if
positive is false).
If NaN, returns same value.
Does not affect floating-point flags,
provided these member functions do not:
Double.longBitsToDouble(long)
Double.doubleToLongBits(double)
Double.isNaN(double)
- Parameters:
d - the reference value
positive - true if the least double is desired;
false otherwise
- Returns:
- the least or greater double value
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|