How to convert a byte array to a String in Java:
To convert a byte array to a string, create a new String using the byte array as an input argument to the String constructor. Something like this:
byte[] bytes = initializeByteArray();
String str = new String(bytes);
To convert a string to a byte array, you can use the String API getBytes() :
String str = "Hello"
byte[] bytes = str.getBytes();
To convert a byte array to a string, create a new String using the byte array as an input argument to the String constructor. Something like this:
byte[] bytes = initializeByteArray();
String str = new String(bytes);
To convert a string to a byte array, you can use the String API getBytes() :
String str = "Hello"
byte[] bytes = str.getBytes();