private final static BigSegmentedArray newInstance(int termCount, int maxDoc) {
// we use < instead of <= to take into consideration "missing" value (zero element in the
// dictionary)
if (termCount < Byte.MAX_VALUE) {
return new BigByteArray(maxDoc);
} else if (termCount < Short.MAX_VALUE) {
return new BigShortArray(maxDoc);
} else return new BigIntArray(maxDoc);
}