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

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: