code: public BinaryEncoder writeInt(int i) throws IOException {
      // Compute the zig-zag value. First double the value and flip the bit if the input is negative.
      int val = (i << 1) ^ (i >> 31);
  
      if ((val & ~0x7f) != 0) {
        output.write(0x80 | val & 0x7f);
        val >>>= 7;
        while (val > 0x7f) {
          output.write(0x80 | val & 0x7f);
          val >>>= 7;
        }
      }
      output.write(val);
  
      return this;
    }
docs: write a single int value.
  @throws java.io.IOException If there is IO error.