Class MathUtil


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

      • MathUtil

        public MathUtil()
    • Method Detail

      • 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