先将方法写出来:public static boolean isOdd(int n) { return (n & 1) != 0;}通常这种算法比常用的 n % 2 != 0 要快一些,取决于虚拟机和平台的不同而不同。