code: public void encodeNBitUnsignedInteger(int b, int n) throws IOException {
  		if (b < 0 || n < 0) {
  			throw new IllegalArgumentException(
  					"Negative value as unsigned integer!");
  		}
  		assert (b >= 0);
  		assert (n >= 0);
  
  		if (n == 0) {
  			// 0 bytes
  		} else if (n < 9) {
  			// 1 byte
  			encode(b & 0xff);
  		} else if (n < 17) {
  			// 2 bytes
  			encode(b & 0x00ff);
  			encode((b & 0xff00) >> 8);
  		} else if (n < 25) {
  			// 3 bytes
  			encode(b & 0x0000ff);
  			encode((b & 0x00ff00) >> 8);
  			encode((b & 0xff0000) >> 16);
  		} else if (n < 33) {
  			// 4 bytes
  			encode(b & 0x000000ff);
  			encode((b & 0x0000ff00) >> 8);
  			encode((b & 0x00ff0000) >> 16);
  			encode((b & 0xff000000) >> 24);
  		} else {
  			throw new RuntimeException(
  					"Currently not more than 4 Bytes allowed for NBitUnsignedInteger!");
  		}
  	}
docs: Encode n-bit unsigned integer using the minimum number of bytes required
  to store n bits. The n least significant bits of parameter b starting
  with the most significant, i.e. from left to right.