ULocale en = new ULocale("en");
ScientificNumberFormatter fmt = ScientificNumberFormatter.getMarkupInstance(
en, "<sup>", "</sup>");
// Output: "1.23456×10<sup>-78</sup>" System.out.println(fmt.format(1.23456e-78));
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private abstract static class | ScientificNumberFormatter.Style
A style type for ScientificNumberFormatter. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final DecimalFormat | |
| private final String | |
| private final ScientificNumberFormatter. | |
| private static final ScientificNumberFormatter. |
| Access | Constructor and Description |
|---|---|
| private | ScientificNumberFormatter(DecimalFormat decimalFormat, String preExponent, ScientificNumberFormatter.
|
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| private static ScientificNumberFormatter | |
| private static ScientificNumberFormatter | |
| public static ScientificNumberFormatter | Returns: The ScientificNumberFormatter instance.The locale locale, String the markup to start superscript e.g beginMarkup, String <sup>the markup to end superscript e.g endMarkup)</sup>Gets a ScientificNumberFormatter instance that uses markup for exponents for this locale. |
| public static ScientificNumberFormatter | Returns: The ScientificNumberFormatter instance.The DecimalFormat must be configured for scientific
notation. Caller may safely change df after this call as this method
clones it when creating the ScientificNumberFormatter. df, String the markup to start superscript e.g beginMarkup, String <sup>the markup to end superscript e.g endMarkup)</sup>Gets a ScientificNumberFormatter instance that uses markup for exponents. |
| private static String | |
| public static ScientificNumberFormatter | Returns: The ScientificNumberFormatter instance.The locale locale)Gets a ScientificNumberFormatter instance that uses superscript characters for exponents for this locale. |
| public static ScientificNumberFormatter | Returns: the ScientificNumberFormatter instance.The DecimalFormat must be configured for scientific
notation. Caller may safely change df after this call as this method
clones it when creating the ScientificNumberFormatter. df)Gets a ScientificNumberFormatter instance that uses superscript characters for exponents. |
| fmt | back to summary |
|---|---|
| private final DecimalFormat fmt | |
| preExponent | back to summary |
|---|---|
| private final String preExponent | |
| style | back to summary |
|---|---|
| private final ScientificNumberFormatter. | |
| SUPER_SCRIPT | back to summary |
|---|---|
| private static final ScientificNumberFormatter. | |
| ScientificNumberFormatter | back to summary |
|---|---|
| private ScientificNumberFormatter(DecimalFormat decimalFormat, String preExponent, ScientificNumberFormatter. | |
| format | back to summary |
|---|---|
| public String format(Object number) Formats a number | |
| getInstance | back to summary |
|---|---|
| private static ScientificNumberFormatter getInstance(DecimalFormat decimalFormat, ScientificNumberFormatter. | |
| getInstanceForLocale | back to summary |
|---|---|
| private static ScientificNumberFormatter getInstanceForLocale(ULocale locale, ScientificNumberFormatter. | |
| getMarkupInstance | back to summary |
|---|---|
| public static ScientificNumberFormatter getMarkupInstance(ULocale locale, String beginMarkup, String endMarkup) Gets a ScientificNumberFormatter instance that uses markup for exponents for this locale.
| |
| getMarkupInstance | back to summary |
|---|---|
| public static ScientificNumberFormatter getMarkupInstance(DecimalFormat df, String beginMarkup, String endMarkup) Gets a ScientificNumberFormatter instance that uses markup for exponents.
| |
| getPreExponent | back to summary |
|---|---|
| private static String getPreExponent(DecimalFormatSymbols dfs) | |
| getSuperscriptInstance | back to summary |
|---|---|
| public static ScientificNumberFormatter getSuperscriptInstance(ULocale locale) Gets a ScientificNumberFormatter instance that uses superscript characters for exponents for this locale.
| |
| getSuperscriptInstance | back to summary |
|---|---|
| public static ScientificNumberFormatter getSuperscriptInstance(DecimalFormat df) Gets a ScientificNumberFormatter instance that uses superscript characters for exponents.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | format(AttributedCharacterIterator iterator, String preExponent)
Implements abstract com. |
| beginMarkup | back to summary |
|---|---|
| private final String beginMarkup | |
| endMarkup | back to summary |
|---|---|
| private final String endMarkup | |
| MarkupStyle | back to summary |
|---|---|
| pack-priv MarkupStyle(String beginMarkup, String endMarkup) | |
| format | back to summary |
|---|---|
| pack-priv String format(AttributedCharacterIterator iterator, String preExponent) Implements abstract com.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static void | |
| pack-priv abstract String |
| Style | back to summary |
|---|---|
| private Style() | |
| append | back to summary |
|---|---|
| pack-priv static void append(AttributedCharacterIterator iterator, int start, int limit, StringBuilder result) | |
| format | back to summary |
|---|---|
| pack-priv abstract String format(AttributedCharacterIterator iterator, String preExponent) | |
| Modifier and Type | Field and Description |
|---|---|
| private static final char[] | |
| private static final char | |
| private static final char |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static int | |
| private static void | |
| pack-priv String | format(AttributedCharacterIterator iterator, String preExponent)
Implements abstract com. |
| SUPERSCRIPT_DIGITS | back to summary |
|---|---|
| private static final char[] SUPERSCRIPT_DIGITS | |
| SUPERSCRIPT_MINUS_SIGN | back to summary |
|---|---|
| private static final char SUPERSCRIPT_MINUS_SIGN | |
| SUPERSCRIPT_PLUS_SIGN | back to summary |
|---|---|
| private static final char SUPERSCRIPT_PLUS_SIGN | |
| SuperscriptStyle | back to summary |
|---|---|
| private SuperscriptStyle() | |
| char32AtAndAdvance | back to summary |
|---|---|
| private static int char32AtAndAdvance(AttributedCharacterIterator iterator) | |
| copyAsSuperscript | back to summary |
|---|---|
| private static void copyAsSuperscript(AttributedCharacterIterator iterator, int start, int limit, StringBuilder result) | |
| format | back to summary |
|---|---|
| pack-priv String format(AttributedCharacterIterator iterator, String preExponent) Implements abstract com.
| |