判断一个数是否为2的整数次幂

public static boolean is2Power3(int num) {
   return (num & num - 1) == 0;
}
posted @ 2019-09-09 15:43  紫枫夜羽  阅读(167)  评论(0编辑  收藏  举报