Here you can find the source of writeVarInt(ByteBuffer buffer, int input)
public static void writeVarInt(ByteBuffer buffer, int input)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static void writeVarInt(ByteBuffer buffer, int input) { while ((input & -128) != 0) { buffer.put((byte) (input & 127 | 128)); input >>>= 7;//w w w.j av a 2 s . c o m } buffer.put((byte) input); } }