public void setFinalIndex(int nullTerm, int finalTerm) { this.nullTermNum = nullTerm; int size = this.index.getSize(); if (finalTerm < Byte.MAX_VALUE) { this.indexDatatype = UnInvertedFieldUtils.TypeIndex.d_byte; this.indexbyte = BYTE_BUFFER.calloc(size, BigReUsedBuffer.BYTE_CREATE, (byte) nullTerm); for (int i = 0; i < size; i++) { int t = this.index.get(i); if (t >= 0) { this.indexbyte.set(i, (byte) t); } } INT_BUFFER.free(this.index); this.index = null; } else if (finalTerm < Short.MAX_VALUE) { this.indexDatatype = UnInvertedFieldUtils.TypeIndex.d_short; this.indexshort = SHORT_BUFFER.calloc(size, BigReUsedBuffer.SHORT_CREATE, (short) nullTerm); for (int i = 0; i < size; i++) { int t = this.index.get(i); if (t >= 0) { this.indexshort.set(i, (short) t); } } INT_BUFFER.free(this.index); this.index = null; } else { this.indexDatatype = UnInvertedFieldUtils.TypeIndex.d_int; ; for (int i = 0; i < size; i++) { int t = this.index.get(i); if (t < 0) { this.index.set(i, nullTerm); } } } }