public class ByteToString
{
public static void main(String[] args) {
String example = "This is an example";
byte[] bytes = example.getBytes();
System.out.println("Text : " + example);
System.out.println("Text in Byte Format] : " + bytes);
System.out.println("Text in Byte Format] : " + bytes.toString());
String s = new String(bytes);
System.out.println("Text converted : " + s);
}
}
No comments:
Post a Comment