Varint { public static String intToVarint(int input) { return on(" ").join(addMSB(reverse(groupOfSevenBits(toBinaryString(input))))); }  static String intToVarint(int input);  }
@Test public void acceptance() { assertThat(Varint.intToVarint(1)).isEqualTo("0000 0001"); assertThat(Varint.intToVarint(300)).isEqualTo("1010 1100 0000 0010"); }
@Test public void should_convert_int_to_varint() { assertThat(Varint.intToVarint(1)).isEqualTo("0000 0001"); assertThat(Varint.intToVarint(7)).isEqualTo("0000 0111"); assertThat(Varint.intToVarint(8)).isEqualTo("0000 1000"); assertThat(Varint.intToVarint(127)).isEqualTo("0111 1111"); assertThat(Varint.intToVarint(128)).isEqualTo("1000 0000 0000 0001"); assertThat(Varint.intToVarint(129)).isEqualTo("1000 0001 0000 0001"); }