public int find(int[] numbers, int position) {
    validateInput(numbers, position);
    Integer result = null;
    Map<Integer, Integer> counter = new LinkedHashMap<Integer, Integer>();
    for (int i : numbers) {
      if (counter.get(i) == null) {
        counter.put(i, 1);
      } else {
        counter.put(i, counter.get(i) + 1);
      }
    }
    for (Integer candidate : counter.keySet()) {
      if (counter.get(candidate) == position) {
        result = candidate;
        break;
      }
    }
    validateResult(result);
    return result;
  }
Iterative solution to solve this problem. This algorithm is based on a complexity order equals
to O(N) and space O(N) because you need to go through the full set numbers two times and you
need a map to store the number of repetitions for every element.
src/main/java/com/github/pedrovgs/problem45/FindNthMostRepeatedElement.java