@Override
            public int compareTo(Entry other) {
                for (int i = 0; i < ngram.length; i++) {
                    if (ngram[i] != other.ngram[i]) {
                        return ngram[i] - other.ngram[i];
                    }
                }
                return 0;
            }
Ensure that the entries array is in sync with the ngrams.
tika-langdetect/tika-langdetect-tika/src/main/java/org/apache/tika/langdetect/tika/LanguageProfile.java