Added in API level 30

Scale


public class Scale
extends Object

java.lang.Object
   ↳ android.icu.number.Scale


A class that defines a quantity by which a number should be multiplied when formatting.

To create a Multiplier, use one of the factory methods.

See also:

Summary

Public methods

static Scale byBigDecimal(BigDecimal multiplicand)

Multiply numbers by an arbitrary value before formatting.

static Scale byDouble(double multiplicand)

Multiply numbers by an arbitrary value before formatting.

static Scale byDoubleAndPowerOfTen(double multiplicand, int power)

Multiply a number by both a power of ten and by an arbitrary double value before formatting.

static Scale none()

Do not change the value of numbers when formatting or parsing.

static Scale powerOfTen(int power)

Multiply numbers by 100 before formatting.

Inherited methods

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

byBigDecimal

Added in API level 30
public static Scale byBigDecimal (BigDecimal multiplicand)

Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.

This method takes a BigDecimal; also see the version that takes a double.

Parameters
multiplicand BigDecimal

Returns
Scale A Multiplier for passing to the setter in NumberFormatter.

See also:

byDouble

Added in API level 30
public static Scale byDouble (double multiplicand)

Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.

This method takes a double; also see the version that takes a BigDecimal.

Parameters
multiplicand double

Returns
Scale A Multiplier for passing to the setter in NumberFormatter.

See also:

byDoubleAndPowerOfTen

Added in API level 30
public static Scale byDoubleAndPowerOfTen (double multiplicand, 
                int power)

Multiply a number by both a power of ten and by an arbitrary double value before formatting.

Parameters
multiplicand double

power int

Returns
Scale A Multiplier for passing to the setter in NumberFormatter.

See also:

none

Added in API level 30
public static Scale none ()

Do not change the value of numbers when formatting or parsing.

Returns
Scale A Multiplier to prevent any multiplication.

See also:

powerOfTen

Added in API level 30
public static Scale powerOfTen (int power)

Multiply numbers by 100 before formatting. Useful for combining with a percent unit:

 NumberFormatter.with().unit(NoUnit.PERCENT).multiplier(Multiplier.powerOfTen(2))
 

Parameters
power int

Returns
Scale A Multiplier for passing to the setter in NumberFormatter.

See also: