Class Number

java.lang.Object
io.keikai.doc.collab.lib0.Number

public class Number extends Object
Number Utility
  • Field Details

  • Method Details

    • isInteger

      public static boolean isInteger(double num)
      Checks if a number is an integer.
      Parameters:
      num - The number to check.
      Returns:
      True if the number is an integer, false otherwise.
    • isNaN

      public static boolean isNaN(double num)
      Checks if a value is NaN.
      Parameters:
      num - The value to check.
      Returns:
      True if the value is NaN, false otherwise.
    • parseInt

      public static int parseInt(String str, int radix)
      Parses a string into an integer.
      Parameters:
      str - The string to parse.
      radix - The radix to use (e.g., 10 for decimal, 16 for hexadecimal).
      Returns:
      The parsed integer.
    • countBits

      public static int countBits(int n)
      Counts the number of "1" bits in an unsigned 32-bit number. This uses Brian Kernighan's algorithm.
      Parameters:
      n - The number to count bits in.
      Returns:
      The number of "1" bits.