code: public static <E> int hIndex(Counter<E> citationCounts) {
      Counter<Integer> countCounts = new ClassicCounter<Integer>();
      for (double value : citationCounts.values()) {
        for (int i = 0; i <= value; ++i) {
          countCounts.incrementCount(i);
        }
      }
      List<Integer> citationCountValues = CollectionUtils.sorted(countCounts.keySet());
      Collections.reverse(citationCountValues);
      for (int citationCount : citationCountValues) {
        double occurrences = countCounts.getCount(citationCount);
        if (occurrences >= citationCount) {
          return citationCount;
        }
      }
      return 0;
    }
docs: Calculate h-Index (Hirsch, 2005) of an author.
  
  A scientist has index h if h of their Np papers have at least h citations
  each, and the other (Np − h) papers have at most h citations each.
  
  @param citationCounts
  Citation counts for each of the articles written by the author.
  The keys can be anything, but the values should be integers.
  @return The h-Index of the author.