/** * Converts a byte array into a hex string * @param bs source byte array * @return hexadecimal representation of bytes */ public static String byte2hex(byte[] bs) { return byte2hex(bs, 0, bs.length); }
@Override public int unpack(ISOComponent c, byte[] b, int offset) throws ISOException { byte[] tagBytes = new byte[getMaxPackedLength()]; System.arraycopy(b, offset, tagBytes, 0, tagBytes.length); c.setValue(ISOUtil.byte2hex(tagBytes)); return tagBytes.length; } }
consumed = consumed + tagUnpackResult.consumed; final byte[] tagBytes = tagUnpackResult.value; String tag = ISOUtil.byte2hex(tagBytes).toUpperCase(); UnpackResult lengthUnpackResult = unpackLength(b, consumed); consumed = consumed + lengthUnpackResult.consumed;
System.out.println("Packed: " + ISOUtil.byte2hex(packed)); Assert.assertEquals("Pack error", "3032365a08999999123456789f9f12044a504f53500251325f2a020840", ISOUtil.byte2hex(field48Packed)); Assert.assertEquals("Pack error", "3032365a08999999123456789f9f12044a504f53500251325f2a020840", ISOUtil.byte2hex(field48Packed));