question: public int readGolomb ( int divisor ) throws IOException { int q = 0 ; while ( readBit ( MAX_PROBABILITY / 2 ) ) { q ++ ; } int bit = 31 - Integer . numberOfLeadingZeros ( divisor - 1 ) ; int r = 0 ; if ( bit >= 0 ) { int cutOff = ( 2 << bit ) - divisor ; for ( ; bit > 0 ; bit -- ) { r = ( r << 1 ) + ( readBit ( MAX_PROBABILITY / 2 ) ? 1 : 0 ) ; } if ( r >= cutOff ) { r = ( r << 1 ) + ( readBit ( MAX_PROBABILITY / 2 ) ? 1 : 0 ) - cutOff ; } } return q * divisor + r ; }
target:  Read a value that is stored as a Golomb code.