Added in API level 30

ScientificNotation


public class ScientificNotation
extends Notation

java.lang.Object
   ↳ android.icu.number.Notation
     ↳ android.icu.number.ScientificNotation


A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter.

To create a ScientificNotation, use one of the factory methods in Notation.

See also:

Summary

Public methods

ScientificNotation withExponentSignDisplay(NumberFormatter.SignDisplay exponentSignDisplay)

Sets whether to show the sign on positive and negative exponents in scientific notation.

ScientificNotation withMinExponentDigits(int minExponentDigits)

Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary.

Inherited methods

static CompactNotation compactLong()

Print the number using long-form compact notation.

static CompactNotation compactShort()

Print the number using short-form compact notation.

static ScientificNotation engineering()

Print the number using engineering notation, a variant of scientific notation in which the exponent must be divisible by 3.

static ScientificNotation scientific()

Print the number using scientific notation (also known as scientific form, standard index form, or standard form in the UK).

static SimpleNotation simple()

Print the number using simple notation without any scaling by powers of ten.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(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 wait(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 wait()

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

Public methods

withExponentSignDisplay

Added in API level 30
public ScientificNotation withExponentSignDisplay (NumberFormatter.SignDisplay exponentSignDisplay)

Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO, showing the minus sign but not the plus sign.

For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in en-US instead of the default "1.23E2".

Parameters
exponentSignDisplay NumberFormatter.SignDisplay: The strategy for displaying the sign in the exponent.

Returns
ScientificNotation A ScientificNotation, for chaining.

See also:

withMinExponentDigits

Added in API level 30
public ScientificNotation withMinExponentDigits (int minExponentDigits)

Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary. Useful for fixed-width display.

For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in en-US instead of the default "1.23E2".

Parameters
minExponentDigits int: The minimum number of digits to show in the exponent.

Returns
ScientificNotation A ScientificNotation, for chaining.

Throws
IllegalArgumentException if minExponentDigits is too big or smaller than 1

See also: