💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
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; } } ~~~