IOUtils { public static int getVarSize(long i) { if (i < 0xFD) { return 1; } else if (i <= 0xFFFF) { return 1 + 2; } else if (i <= 0xFFFFFFFFL) { return 1 + 4; } else { return 1 + 8; } }  static int getVarSize(long i); static int getVarSize(List<? extends NeoSerializable> serializables); static int getVarSize(byte[] bytes);  }
@Test public void getSizeOfVarInt() { assertThat(IOUtils.getVarSize(0), is(1)); assertThat(IOUtils.getVarSize(252), is(1)); assertThat(IOUtils.getVarSize(253), is(3)); assertThat(IOUtils.getVarSize(254), is(3)); assertThat(IOUtils.getVarSize(65_534), is(3)); assertThat(IOUtils.getVarSize(65_535), is(3)); assertThat(IOUtils.getVarSize(65_536), is(5)); assertThat(IOUtils.getVarSize(2_147_483_647), is(5)); }