1public static ArrayList<Integer> getDivisors(int n){
2 ArrayList<Integer> divisors = new ArrayList<>();
3 //without 1 or n
4 for (int i = 2; i * i <= n; ++i)
5 if (n % i == 0) {
6 divisors.add(i);
7 if (i != n / i) divisors.add(n / i);
8 }
9 return divisors;
10 }