public void decodeSortedArray(final int[] values, int offset, int subsize, final int nextbitpos, int value) {
        if (subsize == 1) { // last-choice shortcut
            if (nextbitpos >= 0) {
                value |= decodeBitsReverse(nextbitpos + 1);
            }
            values[offset] = value;
            return;
        }
        if (nextbitpos < 0) {
            while (subsize-- > 0) {
                values[offset++] = value;
            }
            return;
        }

        final int size1 = decodeBounded(subsize);
        final int size2 = subsize - size1;

        if (size1 > 0) {
            decodeSortedArray(values, offset, size1, nextbitpos - 1, value);
        }
        if (size2 > 0) {
            decodeSortedArray(values, offset + size1, size2, nextbitpos - 1, value | (1 << nextbitpos));
        }
    }
@param values     the array to encode
@param offset     position in this array where to start
@param subsize    number of values to encode
@param nextbitpos bitmask with the most significant bit set to 1
@param value      should be 0
main/src/main/java/cgeo/geocaching/brouter/codec/StatCoderContext.java