@Override
        public String next() {
            String ret = next;
            currGram++;
            if (currGram > maxGram) {
                currGram = minGram;
                pos++;
                if (pos + maxGram < buffer.length) {
                    //lowercase the last character; we've already
                    //lowercased all previous chars
                    buffer[pos + maxGram] = Character.toLowerCase(buffer[pos + maxGram]);
                }
            }
            if (pos + currGram > buffer.length) {
                currGram = minGram;
                pos++;
            }
            if (pos >= buffer.length - 1) {
                next = null;
                return ret;
            } else {
                next = new String(buffer, pos, currGram);
                return ret;
            }
        }
Override this for different behavior to determine if there is enough
confidence in the predictions to stop.

@param predictionsQueue
@param newPredictions
@param ngramCounts
@return
tika-langdetect/tika-langdetect-opennlp/src/main/java/org/apache/tika/langdetect/opennlp/ProbingLanguageDetector.java