### Question:
StringUtil { public static String getEncoding(byte[] bytes) { String defaultEncoding = "UTF-8"; try(ByteArrayInputStream in = new ByteArrayInputStream(bytes)) { java.nio.charset.Charset charset = detector.detectCodepage(in, bytes.length); defaultEncoding = charset.name(); } catch (IOException e) { } return defaultEncoding; }  static String getMiddleString(String text, String lStr, String rStr); static String deleteCRLFOnce(String input); static String str2HexStr(String str); static String hexStr2Str(String hexStr); static String byte2HexStr(byte[] b); static byte[] hexStr2Bytes(String src); static String str2Unicode(String strText); static String unicode2Str(String hex); static String delTagsFContent(String content); static String formatSize(double size); static String getEncoding(byte[] bytes); static List<Node> getFileList(Torrent torrent); static CodepageDetectorProxy detector; }### Answer:
@Test public void testGetEncoding() { assertEquals("US-ASCII", StringUtil.getEncoding(new byte[] {40, 74, 127})); }