判断某数是否为质数 新思路:借助boolean数组 0和1不是质数 如果x是质数,那么x的n倍肯定不是质数,即2x, 3x, 4*x…不是质数 boolean数组默认true,从i=2开始,对i的倍数从i倍开始,置为false public static boolean isPrimer(int n) { boolean[] countPrime = new boolean[n+