public EncodedElement packInt(int[] inputArray, int bitSize,
      int start, int skip, int countA) {
    //go to end if we're not there.
    if(next != null) {
      EncodedElement end = EncodedElement.getEnd_S(next);
      return end.packInt(inputArray, bitSize, start, skip, countA);
    }
    //calculate how many we can pack into current.
    int writeCount = (data.length*8 - usableBits) / bitSize;
    if(writeCount > countA) writeCount = countA;
    //pack them and update usable bits.
    EncodedElement.packInt(inputArray, bitSize, usableBits, start, skip, countA, data);
    usableBits += writeCount * bitSize;
    //if more remain, create child object and add there
    countA -= writeCount;
    if(countA > 0) {
      int tOff = usableBits %8;
      int size = data.length/2+1;
      //guarantee that our new element can store our given value
      if(size < bitSize*countA) size = bitSize*countA+10;
      next = new EncodedElement(size, tOff);
      //add int to child
      return next.packInt(inputArray, bitSize, start+writeCount*(skip+1), skip, countA);
    }
    else {
      //return last object we write to.
      return this;
    }
  }
public EncodedElement packInt ( int [ ] inputArray , int bitSize , int start , int skip , int countA ) { if ( next != null ) { EncodedElement end = EncodedElement . getEnd_S ( next ) ; return end . packInt ( inputArray , bitSize , start , skip , countA ) ; } int writeCount = ( data . length * 8 - usableBits ) / bitSize ; if ( writeCount > countA ) writeCount = countA ; EncodedElement . packInt ( inputArray , bitSize , usableBits , start , skip , countA , data ) ; usableBits += writeCount * bitSize ; countA -= writeCount ; if ( countA > 0 ) { int tOff = usableBits % 8 ; int size = data . length / 2 + 1 ; if ( size < bitSize * countA ) size = bitSize * countA + 10 ; next = new EncodedElement ( size , tOff ) ; return next . packInt ( inputArray , bitSize , start + writeCount * ( skip + 1 ) , skip , countA ) ; } else { return this ; } }
Append an equal number of bits from each int in an array within given
limits to the end of this list.

@param inputArray Array storing input values.
@param bitSize number of bits to store from each value.
@param start index of first usable index.
@param skip number of indices to skip between values(in case input data
is interleaved with non-desirable data).
@param countA Number of total indices to store from.
@return EncodedElement containing end of packed data. Data may flow
between multiple EncodedElement's, if an existing element was not large
enough for all values.