bool isPowerOfTwo(int n) { if (n < 1) return false; int m = 1; for (int i = 0; i < 32; i++) { int j = n & m; if (j == n) return true; m = m << 1; } return false; }
posted on 2018-02-06 11:50 willaty 阅读(72) 评论(0) 编辑 收藏 举报
Powered by: 博客园 Copyright © 2024 willaty Powered by .NET 9.0 on Kubernetes