@Test public void testArrayToByteString() { assertEquals("", Bencode.arrayToByteString(new byte[]{})); assertEquals("\n", Bencode.arrayToByteString(new byte[]{10})); assertEquals("CoDe", Bencode.arrayToByteString(new byte[]{'C','o','D','e'})); assertEquals("\u00FF\u0080\u007F", Bencode.arrayToByteString(new byte[]{-1,-128,127})); }
public static String arrayToByteString(byte[] arr) { char[] result = new char[arr.length]; for (int i = 0; i < arr.length; i++) result[i] = (char)(arr[i] & 0xFF); return new String(result); }
Bencode { public static String arrayToByteString(byte[] arr) { char[] result = new char[arr.length]; for (int i = 0; i < arr.length; i++) result[i] = (char)(arr[i] & 0xFF); return new String(result); } }
Bencode { public static String arrayToByteString(byte[] arr) { char[] result = new char[arr.length]; for (int i = 0; i < arr.length; i++) result[i] = (char)(arr[i] & 0xFF); return new String(result); } private  Bencode(InputStream in); }
Bencode { public static String arrayToByteString(byte[] arr) { char[] result = new char[arr.length]; for (int i = 0; i < arr.length; i++) result[i] = (char)(arr[i] & 0xFF); return new String(result); } private  Bencode(InputStream in); static void serialize(Object obj, OutputStream out); static Object parse(InputStream in); static byte[] byteStringToArray(String str); static String arrayToByteString(byte[] arr); }
Bencode { public static String arrayToByteString(byte[] arr) { char[] result = new char[arr.length]; for (int i = 0; i < arr.length; i++) result[i] = (char)(arr[i] & 0xFF); return new String(result); } private  Bencode(InputStream in); static void serialize(Object obj, OutputStream out); static Object parse(InputStream in); static byte[] byteStringToArray(String str); static String arrayToByteString(byte[] arr);  }