Class Scale

java.lang.Object
com.ibm.icu.number.Scale

public class Scale extends Object
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:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyReciprocalTo(com.ibm.icu.impl.number.DecimalQuantity quantity)
    Deprecated.
    ICU 62 This API is ICU internal only.
    void
    applyTo(com.ibm.icu.impl.number.DecimalQuantity quantity)
    Deprecated.
    ICU 62 This API is ICU internal only.
    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
    Do not change the value of numbers when formatting or parsing.
    static Scale
    powerOfTen(int power)
    Multiply numbers by 100 before formatting.
    Deprecated.
    ICU 62 This API is ICU internal only.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • none

      public static Scale none()
      Do not change the value of numbers when formatting or parsing.
      Returns:
      A Multiplier to prevent any multiplication.
      See Also:
    • powerOfTen

      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:
      A Multiplier for passing to the setter in NumberFormatter.
      See Also:
    • byBigDecimal

      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:
      A Multiplier for passing to the setter in NumberFormatter.
      See Also:
    • byDouble

      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:
      A Multiplier for passing to the setter in NumberFormatter.
      See Also:
    • byDoubleAndPowerOfTen

      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:
      A Multiplier for passing to the setter in NumberFormatter.
      See Also:
    • withMathContext

      @Deprecated public Scale withMathContext(MathContext mc)
      Deprecated.
      ICU 62 This API is ICU internal only.
    • applyTo

      @Deprecated public void applyTo(com.ibm.icu.impl.number.DecimalQuantity quantity)
      Deprecated.
      ICU 62 This API is ICU internal only.
    • applyReciprocalTo

      @Deprecated public void applyReciprocalTo(com.ibm.icu.impl.number.DecimalQuantity quantity)
      Deprecated.
      ICU 62 This API is ICU internal only.