Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#inhmethods)

# ScientificNumberFormatter

*** ** * ** ***

` public final class ScientificNumberFormatter `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.icu.text.ScientificNumberFormatter |

<br />

*** ** * ** ***

A formatter that formats numbers in user-friendly scientific notation. ScientificNumberFormatter instances are immutable and thread-safe. Sample code:

```
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));
```

<br />

## Summary

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#format(java.lang.Object)(https://developer.android.com/reference/java/lang/Object number) ` Formats a number |
| ` static https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | ` https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#getMarkupInstance(android.icu.text.DecimalFormat,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/android/icu/text/DecimalFormat df, https://developer.android.com/reference/java/lang/String beginMarkup, https://developer.android.com/reference/java/lang/String endMarkup) ` Gets a ScientificNumberFormatter instance that uses markup for exponents. |
| ` static https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | ` https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#getMarkupInstance(android.icu.util.ULocale,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/android/icu/util/ULocale locale, https://developer.android.com/reference/java/lang/String beginMarkup, https://developer.android.com/reference/java/lang/String endMarkup) ` Gets a ScientificNumberFormatter instance that uses markup for exponents for this locale. |
| ` static https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | ` https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#getSuperscriptInstance(android.icu.text.DecimalFormat)(https://developer.android.com/reference/android/icu/text/DecimalFormat df) ` Gets a ScientificNumberFormatter instance that uses superscript characters for exponents. |
| ` static https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | ` https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter#getSuperscriptInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale locale) ` Gets a ScientificNumberFormatter instance that uses superscript characters for exponents for this locale. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### format

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String format (Object number)
```

Formats a number

<br />

| Parameters ||
|---|---|
| `number` | `Object`: Can be a double, int, Number or anything that DecimalFormat#format(Object) accepts. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the formatted string. <br /> |

### getMarkupInstance

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ScientificNumberFormatter getMarkupInstance (DecimalFormat df, 
                String beginMarkup, 
                String endMarkup)
```

Gets a ScientificNumberFormatter instance that uses markup for exponents.

<br />

| Parameters ||
|---|---|
| `df` | `DecimalFormat`: 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. <br /> |
| `beginMarkup` | `String`: the markup to start superscript e.g `<sup>` <br /> |
| `endMarkup` | `String`: the markup to end superscript e.g `</sup>` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | The ScientificNumberFormatter instance. <br /> |

### getMarkupInstance

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ScientificNumberFormatter getMarkupInstance (ULocale locale, 
                String beginMarkup, 
                String endMarkup)
```

Gets a ScientificNumberFormatter instance that uses markup for exponents for this locale.

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale`: The locale <br /> |
| `beginMarkup` | `String`: the markup to start superscript e.g `<sup>` <br /> |
| `endMarkup` | `String`: the markup to end superscript e.g `</sup>` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | The ScientificNumberFormatter instance. <br /> |

### getSuperscriptInstance

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ScientificNumberFormatter getSuperscriptInstance (DecimalFormat df)
```

Gets a ScientificNumberFormatter instance that uses superscript characters for exponents.

<br />

| Parameters ||
|---|---|
| `df` | `DecimalFormat`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | the ScientificNumberFormatter instance. <br /> |

### getSuperscriptInstance

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ScientificNumberFormatter getSuperscriptInstance (ULocale locale)
```

Gets a ScientificNumberFormatter instance that uses superscript characters for exponents for this locale.

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale`: The locale <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/ScientificNumberFormatter` | The ScientificNumberFormatter instance. <br /> |