/** * @title:AlgorithmUtil * @description: * @author: dingpeng * @date: 2020/8/11 * * @since: Jdk8 */ public class AlgorithmUtil { //判断是否是质数 public static boolean isPrim(int num){ for(int i=2;i<=Math.sqrt((double)num);i++){ if(num%i==0){ return false; } } return true; } //输出一个数的因子 public static void yinZi(int num){ int i = num; int j=2; while (j <= i) { if(i%j==0) { System.out.println(j); i = i/j; } else { j++; } } } }