Saturday, April 28, 2012

How to convert a byte array into String


Sounds simple and it is simple! But, what if you don’t know how to do this?! Don’t spend your valuable time with small things, just use this:

byte[] byteArray = new byte[] {72, 69, 76, 76, 79};
String value = new String(byteArray);
System.out.println(value);

Output will be:
HELLO

No comments:

Post a Comment