Check out example codes for "java log base 2". It will help you in understanding the concepts better.

Code Example 1

public static int log2(int x)
{
    return (int) (Math.log(x) / Math.log(2));
}

Learn ReactJs, React Native from akashmittal.com