Top Description Fields Constructors Methods
com.ibm.icu.number

public Class Scale

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, .MathContext, com.ibm.icu.impl.number.DecimalQuantity, .RoundingUtils

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.

ICU Status
Stable since ICU 62.
See Also
NumberFormatter

Field Summary

Modifier and TypeField and Description
pack-priv final BigDecimal
private static final BigDecimal
private static final BigDecimal
private static final Scale
private static final Scale
pack-priv final int
pack-priv final MathContext
pack-priv final BigDecimal
private static final Scale

Constructor Summary

AccessConstructor and Description
private
Scale(int magnitude, BigDecimal arbitrary)

private
Scale(int magnitude, BigDecimal arbitrary, MathContext mc)

Method Summary

Modifier and TypeMethod and Description
public void
applyReciprocalTo(DecimalQuantity quantity)

Deprecated ICU 62 This API is ICU internal only.
public void
applyTo(DecimalQuantity quantity)

Deprecated ICU 62 This API is ICU internal only.
public static Scale

Returns:

A Multiplier for passing to the setter in NumberFormatter.
byBigDecimal
(BigDecimal multiplicand)

Multiply numbers by an arbitrary value before formatting.

public static Scale

Returns:

A Multiplier for passing to the setter in NumberFormatter.
byDouble
(double multiplicand)

Multiply numbers by an arbitrary value before formatting.

public static Scale

Returns:

A Multiplier for passing to the setter in NumberFormatter.
byDoubleAndPowerOfTen
(double multiplicand, int power)

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

pack-priv boolean
isValid()

Returns whether the multiplier will change the number.

public static Scale

Returns:

A Multiplier to prevent any multiplication.
none
()

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

public static Scale

Returns:

A Multiplier for passing to the setter in NumberFormatter.
powerOfTen
(int power)

Multiply numbers by 100 before formatting.

public Scale
withMathContext(MathContext mc)

Deprecated ICU 62 This API is ICU internal only.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arbitraryback to summary
pack-priv final BigDecimal arbitrary
BIG_DECIMAL_100back to summary
private static final BigDecimal BIG_DECIMAL_100
BIG_DECIMAL_1000back to summary
private static final BigDecimal BIG_DECIMAL_1000
DEFAULTback to summary
private static final Scale DEFAULT
HUNDREDback to summary
private static final Scale HUNDRED
magnitudeback to summary
pack-priv final int magnitude
mcback to summary
pack-priv final MathContext mc
reciprocalback to summary
pack-priv final BigDecimal reciprocal
THOUSANDback to summary
private static final Scale THOUSAND

Constructor Detail

Scaleback to summary
private Scale(int magnitude, BigDecimal arbitrary)
Scaleback to summary
private Scale(int magnitude, BigDecimal arbitrary, MathContext mc)

Method Detail

applyReciprocalToback to summary
public void applyReciprocalTo(DecimalQuantity quantity)

Deprecated

ICU 62 This API is ICU internal only.

Annotations
@Deprecated
ICU Status
Internal ICU component.
applyToback to summary
public void applyTo(DecimalQuantity quantity)

Deprecated

ICU 62 This API is ICU internal only.

Annotations
@Deprecated
ICU Status
Internal ICU component.
byBigDecimalback to summary
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.

Returns:Scale

A Multiplier for passing to the setter in NumberFormatter.

ICU Status
Stable since ICU 62.
See Also
NumberFormatter
byDoubleback to summary
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.

Returns:Scale

A Multiplier for passing to the setter in NumberFormatter.

ICU Status
Stable since ICU 62.
See Also
NumberFormatter
byDoubleAndPowerOfTenback to summary
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.

Returns:Scale

A Multiplier for passing to the setter in NumberFormatter.

ICU Status
Stable since ICU 62.
See Also
NumberFormatter
isValidback to summary
pack-priv boolean isValid()

Returns whether the multiplier will change the number.

noneback to summary
public static Scale none()

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

Returns:Scale

A Multiplier to prevent any multiplication.

ICU Status
Stable since ICU 62.
See Also
NumberFormatter
powerOfTenback to summary
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))
Returns:Scale

A Multiplier for passing to the setter in NumberFormatter.

ICU Status
Stable since ICU 62.
See Also
NumberFormatter
withMathContextback to summary
public Scale withMathContext(MathContext mc)

Deprecated

ICU 62 This API is ICU internal only.

Annotations
@Deprecated
ICU Status
Internal ICU component.