java.lang.Object
org.jgrapht.util.MathUtil
public class MathUtil
extends java.lang.Object
Math Utilities.
- Author:
- Assaf Lehr
-
Constructor Summary
Constructors
Constructor |
Description |
MathUtil() |
|
-
Method Summary
Modifier and Type |
Method |
Description |
static long |
factorial(int n) |
Calculate the factorial of $n$.
|
static int |
log2(int n) |
Calculate the floor of the binary logarithm of $n$.
|
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Details
-
public static long factorial(int n)
Calculate the factorial of $n$.
- Parameters:
n
- the input number
- Returns:
- the factorial
-
public static int log2(int n)
Calculate the floor of the binary logarithm of $n$.
- Parameters:
n
- the input number
- Returns:
- the binary logarithm