Convert Byte Array to String in Java
In Java, you can use the constructor of the String class to convert a byte array into a string, and then output this string. For example:
byte[] bytes = {65, 66, 67, 68, 69};
String str = new String(bytes);
System.out.println(str);
This code converts the byte array {65, 66, 67, 68, 69} to the string “ABCDE”, and then outputs this string to the console.