Check out example codes for "java is power of 2". It will help you in understanding the concepts better.

Code Example 1

boolean result = number > 0 && ((number & (number - 1)) == 0);

Learn ReactJs, React Native from akashmittal.com