摘要:
interface Task { void runTask(); } public class TimeCountDemo { public static void countTime(Task task) { long start = System.currentTimeMillis(); tas 阅读全文
摘要:
判断一个整数 n 是否为质数思路: 若 n ≤ 1,不是质数; 若 n = 2,是质数; 若 n 是偶数,直接不是质数; 从 3 到√n,逐个试除,如果能被整除则是合数,遍历结束都不能整除则为质数。 public class PrimeDemo { public static boolean isP 阅读全文