Class MathUtil

java.lang.Object
org.jgrapht.util.MathUtil

public class MathUtil extends Object
Math Utilities.
Author:
Assaf Lehr
  • Constructor Details

    • MathUtil

      public MathUtil()
  • Method Details

    • factorial

      public static long factorial(int n)
      Calculate the factorial of $n$.
      Parameters:
      n - the input number
      Returns:
      the factorial
    • log2

      public static int log2(int n)
      Calculate the floor of the binary logarithm of $n$.
      Parameters:
      n - the input number
      Returns:
      the binary logarithm