Answers for "take log base 2 in java"

4

java log base 2

public static int log2(int x)
{
    return (int) (Math.log(x) / Math.log(2));
}
Posted by: Guest on June-07-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language