public EncodedElement addLong ( long input , int bitCount ) { if ( next != null ) { EncodedElement end = EncodedElement . getEnd_S ( next ) ; return end . addLong ( input , bitCount ) ; } else if ( data . length * 8 <= usableBits + bitCount ) { //create child and attach to next. //Set child's offset appropriately(i.e, manually set usable bits) int tOff = usableBits % 8 ; int size = data . length / 2 + 1 ; //guarantee that our new element can store our given value if ( size < bitCount ) size = bitCount * 10 ; next = new EncodedElement ( size , tOff ) ; //add int to child return next . addLong ( input , bitCount ) ; } //At this point, we have the space, and we are the end of the chain. int startPos = this . usableBits ; byte [ ] dest = this . data ; EncodedElement . addLong ( input , bitCount , startPos , dest ) ; usableBits += bitCount ; return this ; }
Add a number of bits from a long to the end of this list s data . Will add a new element if necessary . The bits stored are taken from the lower - order of input .