} else {
// First element should not be discarded
band = codec.decodeInts(count - 1, in, first);
}
if (codecUsed instanceof BHSDCodec && ((BHSDCodec) codecUsed).isDelta()) {
BHSDCodec bhsd = (BHSDCodec) codecUsed;
long cardinality = bhsd.cardinality();
for (int i = 0; i < band.length; i++) {
while (band[i] > bhsd.largest()) {
band[i] -= cardinality;
}
while (band[i] < bhsd.smallest()) {
band[i] += cardinality;
}
}
} else if (codecUsed instanceof PopulationCodec) {
PopulationCodec popCodec = (PopulationCodec) codecUsed;
long[] favoured = (long[]) popCodec.getFavoured().clone();
Arrays.sort(favoured);
for (int i = 0; i < band.length; i++) {
boolean favouredValue = Arrays.binarySearch(favoured, band[i]) > -1;
Codec theCodec = favouredValue ? popCodec.getFavouredCodec()
: popCodec.getUnvafouredCodec();
if (theCodec instanceof BHSDCodec
&& ((BHSDCodec) theCodec).isDelta()) {
BHSDCodec bhsd = (BHSDCodec) theCodec;
long cardinality = bhsd.cardinality();
while (band[i] > bhsd.largest()) {
band[i] -= cardinality;
}
while (band[i] < bhsd.smallest()) {
band[i] += cardinality;
}
}
}
}