Class NumberUtils


  • public final class NumberUtils
    extends Object
    Number utilities.
    Author:
    aherscu
    • Method Detail

      • parseIntOrZero

        public static int parseIntOrZero​(String value)
        Safely parses specified integer.
        Parameters:
        value - integer value as string
        Returns:
        the integer value if parsed successfully, otherwise 0
      • parseLongOrZero

        public static long parseLongOrZero​(String value)
        Safely parses specified long.
        Parameters:
        value - long value as string
        Returns:
        the long value if parsed successfully, otherwise 0
      • safeDoubleOf

        public static double safeDoubleOf​(Number number)
        Returns a double even if no number was supplied.
        Parameters:
        number - the number
        Returns:
        the double representation of the supplied number or Double.NaN if no number was supplied.