code: public static int writeVByte(final int x, final OutputStream os) throws IOException {
  		if (x < (1 << 7)) {
  			os.write(x);
  			return 1;
  		}
  
  		if (x < (1 << 14)) {
  			os.write((x >>> 7 | 0x80));
  			os.write(x & 0x7F);
  			return 2;
  		}
  
  		if (x < (1 << 21)) {
  			os.write((x >>> 14 | 0x80));
  			os.write((x >>> 7 | 0x80));
  			os.write(x & 0x7F);
  			return 3;
  		}
  
  		if (x < (1 << 28)) {
  			os.write((x >>> 21 | 0x80));
  			os.write((x >>> 14 | 0x80));
  			os.write((x >>> 7 | 0x80));
  			os.write(x & 0x7F);
  			return 4;
  		}
  
  		os.write((x >>> 28 | 0x80));
  		os.write((x >>> 21 | 0x80));
  		os.write((x >>> 14 | 0x80));
  		os.write((x >>> 7 | 0x80));
  		os.write(x & 0x7F);
  		return 5;
  	}
docs: Encodes a natural number to an {@link OutputStream} using vByte.
  
  @param x a natural number.
  @param os an output stream.
  @return the number of bytes written.