TlvUtil { public static int getLength(final List<TagAndLength> pList) { int ret = 0; if (pList != null) { for (TagAndLength tl : pList) { ret += tl.getLength(); } } return ret; } private  TlvUtil(); static String getFormattedTagAndLength(final byte[] data, final int indentLength); static TLV getNextTLV(final TLVInputStream stream); static List<TagAndLength> parseTagAndLength(final byte[] data); static String prettyPrintAPDUResponse(final byte[] data); static List<TLV> getlistTLV(final byte[] pData, final ITag pTag, final boolean pAdd); static List<TLV> getlistTLV(final byte[] pData, final ITag... pTag); static byte[] getValue(final byte[] pData, final ITag... pTag); static String prettyPrintAPDUResponse(final byte[] data, final int indentLength); static String getSpaces(final int length); static String prettyPrintHex(final String in, final int indent); static String prettyPrintHex(final byte[] data); static String prettyPrintHex(final String in, final int indent, final boolean wrapLines); static String getSafePrintChars(final byte[] byteArray); static String getSafePrintChars(final byte[] byteArray, final int startPos, final int length); static int getLength(final List<TagAndLength> pList);  }
@Test public void testGetLength() throws Exception { Assertions.assertThat(TlvUtil.getLength(null)).isEqualTo(0); Assertions.assertThat(TlvUtil.getLength(new ArrayList<TagAndLength>())).isEqualTo(0); List<TagAndLength> list = new ArrayList<TagAndLength>(); list.add(new TagAndLength(EmvTags.AID_CARD, 12)); list.add(new TagAndLength(EmvTags.AID_TERMINAL, 2)); Assertions.assertThat(TlvUtil.getLength(list)).isEqualTo(14); }