code: public static final int s16Compress(int[] out, int outOffset, int[] in,
                  int inOffset, int n, int blockSize, int oriBlockSize,
                  int[] oriInputBlock) {
                  int numIdx, j, num, bits;
                  for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
                          out[outOffset] = numIdx << S16_BITSSIZE;
                          // num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
  
                          if (S16_NUM[numIdx] > n)
                                  continue;
                          num = S16_NUM[numIdx];
  
                          for (j = 0, bits = 0; (j < num)
                                  && in[inOffset + j] < (1 << S16_BITS[numIdx][j]);) {
                                  out[outOffset] |= (in[inOffset + j] << bits);
                                  bits += S16_BITS[numIdx][j];
                                  j++;
                          }
  
                          if (j == num) {
                                  return num;
                          }
                  }
  
                  return -1;
          }
docs: Compress an integer array using Simple16
  
  @param out
  the compressed output
  @param outOffset
  the offset of the output in the number of integers
  @param in
  the integer input array
  @param inOffset
  the offset of the input in the number of integers
  @param n
  the number of elements to be compressed
  @param blockSize block size
  @param oriBlockSize  ori block size
  @param oriInputBlock ori input block
  @return the number of compressed integers