java is power of 2

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

Also in Java: