public static void putVarLong(long v, ByteArrayList byteArrayList) {
    while (true) {
      int bits = ((int) v) & 0x7f;
      v >>>= 7;
      if (v == 0) {
        byteArrayList.add((byte) bits);
        return;
      }
      byteArrayList.add((byte) (bits | 0x80));
    }
  }
Encodes a long integer in a variable-length encoding, 7 bits per byte.

@param v             the value to encode
@param byteArrayList the bytes to add the encoded value
planetiler-core/src/main/java/com/onthegomap/planetiler/util/VarInt.java