🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
Given an integer, write a function to determine if it is a power of two. ~~~ public class Solution { public boolean isPowerOfTwo(int n) { int x=0; while(n>0){ x += (n&1); n>>=1; } return x==1; } } ~~~