Class NumberUtils

java.lang.Object
net.darkhax.pricklemc.common.api.util.NumberUtils

public class NumberUtils extends Object
  • Constructor Details

    • NumberUtils

      public NumberUtils()
  • Method Details

    • greaterThan

      public static boolean greaterThan(Number x, Number y)
      Checks if number x is greater than number y.
      Parameters:
      x - The first number.
      y - The second number.
      Returns:
      If x is greater than y.
    • equals

      public static boolean equals(Number x, Number y)
      Checks if number x is equal to number y.
      Parameters:
      x - The first number.
      y - The second number.
      Returns:
      If x is equal to y.
    • lessThan

      public static boolean lessThan(Number x, Number y)
      Checks if number x is less than number y.
      Parameters:
      x - The first number.
      y - The second number.
      Returns:
      If x is less than y.
    • compareNumber

      public static int compareNumber(Number x, Number y)
      Compares two numbers as a comparator.
      Parameters:
      x - The first number.
      y - The second number.
      Returns:
      The results of the comparison.
    • isSpecialNumber

      public static boolean isSpecialNumber(Number number)
      Checks if a number requires special handling. For example NaN and infinity.
      Parameters:
      number - The number to test.
      Returns:
      If the number requires special handling.
    • asBigDecimal

      public static BigDecimal asBigDecimal(Number number)
      Gets a BigDecimal representation of a number. This can be useful when comparing two numbers.
      Parameters:
      number - The number to represent.
      Returns:
      A BigDecimal representation of the number.