class LargestNGramFinder {

  private LargestNGramFinder() {
  }

  public static void main(String[] args) throws IOException {<FILL_FUNCTION_BODY>}
  
}

    if (args.length != 1) {
      System.out.println("Usage: " + LargestNGramFinder.class.getSimpleName() + " <ngramIndexDir>");
      System.exit(1);
    }
    FSDirectory fsDir = FSDirectory.open(new File(args[0]).toPath());
    IndexReader reader = DirectoryReader.open(fsDir);
    IndexSearcher searcher = new IndexSearcher(reader);
    Fields fields = MultiFields.getFields(reader);
    long max = 0;
    String maxTerm = "";
    Terms terms = fields.terms("ngram");
    TermsEnum termsEnum = terms.iterator();
    int count = 0;
    BytesRef next;
    while ((next = termsEnum.next()) != null) {
      String term = next.utf8ToString();
      TopDocs topDocs = searcher.search(new TermQuery(new Term("ngram", term)), 5);
      int docId = topDocs.scoreDocs[0].doc;
      Document document = reader.document(docId);
      long thisCount = Long.parseLong(document.get("count"));
      if (max < thisCount) {
        max = thisCount;
        maxTerm = term;
      }
      if (count % 10_000 == 0) {
        System.out.println(count + " -> " + topDocs.totalHits + " for " + term + " -> " + thisCount + ", max so far: " + max + " for '" + maxTerm + "'");
      }
      count++;
    }
    System.out.println("Max: " + max + " for " + maxTerm);
  
<no_super_class>