code: public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
  		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;
  
  			for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_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
  @return the number of compressed integers