question: public void writeGolomb ( int divisor , int value ) throws IOException { int q = value / divisor ; for ( int i = 0 ; i < q ; i ++ ) { writeBit ( true , MAX_PROBABILITY / 2 ) ; } writeBit ( false , MAX_PROBABILITY / 2 ) ; int r = value - q * divisor ; int bit = 31 - Integer . numberOfLeadingZeros ( divisor - 1 ) ; if ( r < ( ( 2 << bit ) - divisor ) ) { bit -- ; } else { r += ( 2 << bit ) - divisor ; } for ( ; bit >= 0 ; bit -- ) { writeBit ( ( ( r > > > bit ) & 1 ) == 1 , MAX_PROBABILITY / 2 ) ; } }
target:  Write the Golomb code of a value.