code: protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) {
      int origInputIndex = inputIndex;
      inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount,
      destPos, dest);
      if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be
      if(inputIndex < 0)//done, no more to write.
        return;
  
      inputCount = inputCount - (inputIndex - origInputIndex);
      inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex);
      assert(destPos%8 == 0);//sanity check.
      if(inputCount >1) {
        int stopIndex = inputCount-1;
        EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8);
        destPos += (stopIndex)*32;
      }
      if(inputCount >0) {
        int index = inputCount-1;
        EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest);
        destPos+=inputBits[index];
      }
    }
docs: Pack a number of bits from each int of an array(within given limits)to
  the end of this list.
  
  @param inputA Array containing input values.
  @param inputBits Array containing number of bits to use for each index
  packed. This array should be equal in size to the inputA array.
  @param inputIndex Index of first usable index.
  @param inputCount Number of indices to pack.
  @param destPos First usable bit-level index in destination array(byte index = startPosIn/8, bit within that byte = destPos)
  @param dest Destination array to store input values in. This array *must*
  be large enough to store all values or this method will fail in an
  undefined manner.