Class NumberUtils


  • public final class NumberUtils
    extends 
    Since:
    1.0
    Author:
    Daniel Fernández
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static  target,  minIntegerDigits,  decimalDigits,  locale)  
      static  target,  minIntegerDigits,  decimalDigits, NumberPointType decimalPointType,  locale)  
      static  target,  minIntegerDigits,  locale)  
      static  target,  minIntegerDigits, NumberPointType thousandsPointType,  decimalDigits,  locale)  
      static  target,  minIntegerDigits, NumberPointType thousandsPointType,  decimalDigits, NumberPointType decimalPointType,  locale)  
      static  target,  minIntegerDigits, NumberPointType thousandsPointType,  locale)  
      static  target,  locale)
      Formats a number as a currency value according to the specified locale.
      static  target,  minIntegerDigits,  fractionDigits,  locale)
      Formats a number as a percentage value.
      static []  from,  to)
      Produces an array with a sequence of integer numbers.
      static []  from,  to,  step)
      Produces an array with a sequence of integer numbers, using a step.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • format

        public static  format​( target,
                                     minIntegerDigits,
                                     locale)
      • format

        public static  format​( target,
                                     minIntegerDigits,
                                    NumberPointType thousandsPointType,
                                     locale)
      • format

        public static  format​( target,
                                     minIntegerDigits,
                                     decimalDigits,
                                     locale)
      • format

        public static  format​( target,
                                     minIntegerDigits,
                                     decimalDigits,
                                    NumberPointType decimalPointType,
                                     locale)
      • format

        public static  format​( target,
                                     minIntegerDigits,
                                    NumberPointType thousandsPointType,
                                     decimalDigits,
                                     locale)
      • format

        public static  format​( target,
                                     minIntegerDigits,
                                    NumberPointType thousandsPointType,
                                     decimalDigits,
                                    NumberPointType decimalPointType,
                                     locale)
      • sequence

        public static [] sequence​( from,
                                          to)

        Produces an array with a sequence of integer numbers.

        Parameters:
        from - value to start the sequence from
        to - value to produce the sequence to
        Returns:
        the Integer[] sequence
        Since:
        1.1.2
      • sequence

        public static [] sequence​( from,
                                          to,
                                          step)

        Produces an array with a sequence of integer numbers, using a step.

        Parameters:
        from - value to start the sequence from
        to - value to produce the sequence to
        step - the step to be used
        Returns:
        the Integer[] sequence
        Since:
        2.0.9
      • formatCurrency

        public static  formatCurrency​( target,
                                             locale)
        Formats a number as a currency value according to the specified locale.
        Parameters:
        target - The number to format.
        locale - Locale to use for formatting.
        Returns:
        The number formatted as a currency, or null if the number given is null.
      • formatPercent

        public static  formatPercent​( target,
                                            minIntegerDigits,
                                            fractionDigits,
                                            locale)
        Formats a number as a percentage value.
        Parameters:
        target - The number to format.
        minIntegerDigits - Minimum number of digits to return (0 padding).
        fractionDigits - Minimum number of fraction digits to return (0 padding).
        locale - Locale to use for formatting.
        Returns:
        The number formatted as a percentage, or null if the number given is null.