### Question:
Hex { public static final String encode(final byte[] data) { if (data == null || data.length == 0) { return ""; } char str[] = new char[data.length * 2]; int k = 0; for (byte b : data) { str[k++] = HEX[b >>> 4 & 0xf]; str[k++] = HEX[b & 0xf]; } return new String(str); }  static final String encode(final byte[] data); static final byte[] decode(final String data);  }### Answer:
@Test public void testEncode() { String source = "12345AB中国6789"; String encode = Hex.encode(source.getBytes(Charset.forName("utf-8"))); String decode = new String(Hex.decode(encode),Charset.forName("utf-8")); Assert.assertEquals(source, decode); }