### Question:
StringUtils { public static char[] byte2Char(byte[] a) { int len = 0; for (int i = 0; i < a.length; ) { byte b = a[i]; if ((b & 0x80) == 0) { i++; } else if ((b & 0xE0) == 0xC0) { i += 2; } else if ((b & 0xF0) == 0xE0) { i += 3; } else { i++; } len++; } char[] result = new char[len]; int j = 0; for (int i = 0; i < a.length; ) { byte b = a[i]; if ((b & 0x80) == 0) { i++; result[j++] = (char) b; continue; } if ((b & 0xE0) == 0xC0 && a.length - i >= 2) { result[j++] = (char) ((a[i + 1] & 0x3F) | (b & 0x1F) << 6); i += 2; continue; } if ((b & 0xF0) == 0xE0 && a.length - i >= 2) { result[j++] = (char) ((a[i + 2] & 0x3F) | ((a[i + 1] & 0x3F) << 6) | ((b & 0x0F) << 12)); i += 3; continue; } i++; result[j++] = (char) b; } return result; }  static boolean isCharEqual(char[] str); static boolean isNumeric(char[] str); static boolean isContains(char[] a, char[] b); static void clear(char[] a); static void clear(byte[] a); static byte[] char2Byte(char[] a); static char[] byte2Char(byte[] a); static void printOneByte(byte b); static byte[] hexs2Bytes(byte[] a);  }### Answer:
@Test public void byte2Char() { String asc = "test"; byte[] asc1 = asc.getBytes(UTF_8); byte[] asc2 = StringUtils.char2Byte(asc.toCharArray()); Assert.assertArrayEquals(asc1, asc2); char[] ascChars = StringUtils.byte2Char(asc1); Assert.assertArrayEquals(asc.toCharArray(), ascChars); }