//Creating indices for Indices instances
int[] _freeIndices = indices.getFreeIndices().getAllIndices().copy();
int[][] freeIndices = new int[TYPES.length][];
int[][] indicesSpace = new int[TYPES.length][];
IndexGenerator indexGenerator = new IndexGenerator(_freeIndices.clone());
for (byte b : TYPES) {
indicesSpace[b] = new int[totalIndicesCounts[b]];
IndicesTypeStructure.TypeData typeData = typeStructure.getTypeData(b);
if (typeData == null)
freeIndices[b] = new int[0];
else {
freeIndices[b] = new int[typeData.length];
System.arraycopy(_freeIndices, typeData.from, freeIndices[b], 0, typeData.length);
}
int diff = (totalIndicesCounts[b] - freeIndices[b].length) / 2;
for (i = 0; i < diff; ++i)
indicesSpace[b][i] = indexGenerator.generate(b);
for (i = 0; i < diff; ++i)
indicesSpace[b][i + diff] = IndicesUtils.inverseIndexState(indicesSpace[b][i]);
System.arraycopy(freeIndices[b], 0, indicesSpace[b], diff * 2, freeIndices[b].length);
shuffle(indicesSpace[b]);
}