static bool CheckPowerOfTwo(ulong num) { return num > 0 && (num & (num - 1)) == 0; } 转载于:https://www.cnblogs.com/godbell/p/7875802.html