How to convert Byte Array to String in java

Sometimes, we may need to convert String to bytes Array but how to convert bytes array to String back.

toString method does not work correctly here as it just print bytes in String format.

You can use String’s constructor to get String back.

Example:

When you run above program, you will get below output:

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *