Class NumberHelper

java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.NumberHelper

public class NumberHelper extends Object
Static helper class for generic number operations
  • Field Details

    • FORMATTER

      public static final DecimalFormat FORMATTER
    • INT_PATTERN

      public static final Pattern INT_PATTERN
    • LONG_PATTERN

      public static final Pattern LONG_PATTERN
    • DOUBLE_PATTERN

      public static final Pattern DOUBLE_PATTERN
  • Constructor Details

    • NumberHelper

      public NumberHelper()
  • Method Details

    • parseInt

      public static OptionalInt parseInt(String arg)
      Parses the arg to an integer
      Parameters:
      arg - The arg to parse
      Returns:
      The potential parsed integer
    • parseLong

      public static OptionalLong parseLong(String arg)
      Parses the arg to a long
      Parameters:
      arg - The arg to parse
      Returns:
      The potential parsed long
    • parseDouble

      public static OptionalDouble parseDouble(String arg)
      Parses the arg to a double
      Parameters:
      arg - The arg to parse
      Returns:
      The potential parsed double
    • parseNumber

      public static Number parseNumber(String s)
      Attempts to parse the given string to a number
      Parameters:
      s - The string to parse
      Returns:
      The parsed number
    • formatPercentage

      public static String formatPercentage(double d)