Varint { protected static List<String> addMSB(List<String> strings) { int lastIndex = strings.size() - 1; List<String> withSMB = newArrayList(transform(strings, new Function<String, String>() { @Override public String apply(String input) { return "1" + input; } })); String value = "0" + strings.get(lastIndex); withSMB.set(lastIndex, value); return withSMB; }  static String intToVarint(int input);  }
@Test public void should_add_msb() { assertThat(Varint.addMSB(newArrayList("000 0001"))).containsExactly("0000 0001"); assertThat(Varint.addMSB(newArrayList("000 1000"))).containsExactly("0000 1000"); assertThat(Varint.addMSB(newArrayList("000 0000", "000 0001"))).containsExactly("1000 0000", "0000 0001"); assertThat(Varint.addMSB(newArrayList("000 0001", "000 0001"))).containsExactly("1000 0001", "0000 0001"); assertThat(Varint.addMSB(newArrayList("000 0000", "000 0010"))).containsExactly("1000 0000", "0000 0010"); assertThat(Varint.addMSB(newArrayList("000 0000", "100 0000"))).containsExactly("1000 0000", "0100 0000"); assertThat(Varint.addMSB(newArrayList("000 0000", "000 0000", "000 0001"))).containsExactly("1000 0000", "1000 0000", "0000 0001"); }