TLV { public byte[] getValue() { byte[] value = new byte[length]; System.arraycopy(binary, position, value, 0, length); position += length; return value; } TLV(byte[] binary); boolean parse(Tag tag, int offset); byte[] getValue(); int getPosition(); @Override String toString();  }
@Test public void getValue() { Tag tag1 = new Tag(0x04, Tag.CONTEXT, PRIMITIVE, 1); TLV tlv = new TLV(ByteArrayUtil.fromHex("84050011223344")); Assert.assertTrue(tlv.parse(tag1, 0)); Assert.assertArrayEquals(ByteArrayUtil.fromHex("0011223344"), tlv.getValue()); tlv = new TLV(ByteArrayUtil.fromHex("8481050011223344")); Assert.assertTrue(tlv.parse(tag1, 0)); Assert.assertArrayEquals(ByteArrayUtil.fromHex("0011223344"), tlv.getValue()); }