code: public static long getCurrentSegmentGeneration(String[] files) {
      if (files == null) {
        return -1;
      }
      long max = -1;
      for (int i = 0; i < files.length; i++) {
        String file = files[i];
        if (file.startsWith(IndexFileNames.SEGMENTS)
            && !file.equals(IndexFileNames.SEGMENTS_GEN)) {
          long gen = generationFromSegmentsFileName(file);
          if (gen > max) {
            max = gen;
          }
        }
      }
      return max;
    }
docs: Get the generation (N) of the current segments_N file from a list of
  files.
  
  @param files -- array of file names to check