📅  最后修改于: 2022-03-11 14:52:46.848000             🧑  作者: Mango
public static ArrayList getDivisors(int n){
ArrayList divisors = new ArrayList<>();
//without 1 or n
for (int i = 2; i * i <= n; ++i)
if (n % i == 0) {
divisors.add(i);
if (i != n / i) divisors.add(n / i);
}
return divisors;
}