Created
November 18, 2019 03:33
-
-
Save PavelZaytsev/c4571bab49320a2d76b484b9477c7593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
private static boolean isPowerOfTwo(int i){ | |
return (i & (i - 1)) == 0; | |
} | |
public static void main(String[] args) { | |
System.out.println(isPowerOfTwo(4)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment