Package io.keikai.doc.collab.lib0
Class Number
- java.lang.Object
-
- io.keikai.doc.collab.lib0.Number
-
public class Number extends java.lang.ObjectNumber Utility
-
-
Field Summary
Fields Modifier and Type Field Description static intHIGHEST_INT31static longHIGHEST_UINT32static intLOWEST_INT31static longMAX_SAFE_INTEGERstatic longMIN_SAFE_INTEGER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcountBits(int n)Counts the number of "1" bits in an unsigned 32-bit number.static booleanisInteger(double num)Checks if a number is an integer.static booleanisNaN(double num)Checks if a value is NaN.static intparseInt(java.lang.String str, int radix)Parses a string into an integer.
-
-
-
Field Detail
-
MAX_SAFE_INTEGER
public static final long MAX_SAFE_INTEGER
- See Also:
- Constant Field Values
-
MIN_SAFE_INTEGER
public static final long MIN_SAFE_INTEGER
- See Also:
- Constant Field Values
-
LOWEST_INT31
public static final int LOWEST_INT31
- See Also:
- Constant Field Values
-
HIGHEST_INT31
public static final int HIGHEST_INT31
- See Also:
- Constant Field Values
-
HIGHEST_UINT32
public static final long HIGHEST_UINT32
- See Also:
- Constant Field Values
-
-
Method Detail
-
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(java.lang.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.
-
-