question: public long readUBits ( int numBits ) throws IOException { if ( numBits == 0 ) { return 0 ; } int bitsLeft = numBits ; long result = 0 ; if ( bitPos == 0 ) { bitBuf = in . read ( ) ; bitPos = 8 ; bytesRead ++ ; } while ( true ) { int shift = bitsLeft - bitPos ; if ( shift > 0 ) { result |= bitBuf << shift ; bitsLeft -= bitPos ; bitBuf = in . read ( ) ; bitPos = 8 ; bytesRead ++ ; } else { result |= bitBuf > > - shift ; bitPos -= bitsLeft ; bitBuf &= 0xff > > ( 8 - bitPos ) ; return result ; } } }
target:  Read an unsigned value from the given number of bits