常规算法: if(a % 2 == 0){//偶数} else{//奇数} 升级算法: if((a & 1) == 0){//偶数} //偶数的最低位一定是偶数 else{//奇数} 转载于:https://www.cnblogs.com/panda1024/p/6025065.html