Java byte array to string

The simplest way to convert a byte array to a string is to use the String class constructor with byte[] as an argument: byte[] bytes = "Hey, there!".getBytes(); String str = new String(bytes); System.out.println(str); Here is the output of the above code snippet: Hey, there! By default, new String() uses the platform default character encoding ... ................
................