Class Logs


  • public class Logs
    extends Object
    simple utilities with logarithms
    • Constructor Detail

      • Logs

        public Logs()
    • Method Detail

      • isPowerOf2

        public static boolean isPowerOf2​(int x)
        Returns:
        true iff x == 2^n for some integer n
      • binaryLogUp

        public static int binaryLogUp​(int n)
        Binary log: finds the smallest power k such that 2^k>=n
      • binaryLogUp

        public static int binaryLogUp​(long n)
        Binary log: finds the smallest power k such that 2^k>=n