How do I convert a byte array to a string? Is this the correct syntax?
byteArray.toString();
How do I convert a byte array to a string? Is this the correct syntax?
byteArray.toString();
The Best way to convert bytearray to String is
public void convertByteArrayToString(Charset encoding) {
byte[] byteArray = new byte[] {87, 79, 87, 46, 46, 46};
String value = new String(byteArray, encoding);
System.out.println(value);
}
UTF-8. See download.oracle.com/javase/1.4.2/docs/api/java/nio/charset/… for some standard charsets.