public List<Integer> perfectDivisors(int n) {
    List<Integer> divisors = new ArrayList<Integer>();
    divisors.add(1);
    int sum = 1;
    for (int x = 2; x <= Math.sqrt(n); x++) {
      if (n % x == 0) {
        sum += x;
        divisors.add(x);
        if (x != Math.sqrt(n)) {
          divisors.add(n / x);
          sum += n / x;
        }
      }
    }
    //System.out.println(n + " " + sum);
    if (sum == n) {
      Collections.sort(divisors);
      return divisors;
    } else {
      return null;
    }
  }