code: public void writeValue(final int length, final int value)
  		throws EncodingException
  	{
  		if (length > 31) {
  			throw ErrorFactory.createEncodingException(
  					ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
  					"more than maximum length: " + value);
  		}
  
  		for (int i = length - 1; i >= 0; i--) {
  			writeBit((value >> i) & 1);
  		}
  	}
docs: Writes a positive integer to the buffer.
  
  @param length
  the number of bits to write
  @param value
  an integer value
  
  @throws EncodingException
  if the length of the input is more than 31 bits.