finds out if a number is a power of two java code example
Example 1: java is power of 2
boolean result = number > 0 && ((number & (number - 1)) == 0);
Example 2: find if element is powers of 2
powers of 2
boolean result = number > 0 && ((number & (number - 1)) == 0);
powers of 2