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 ; } }
Append an equal number of bits from each int in an array within given limits to the end of this list .