Wednesday, May 26, 2010

How to get a byte array from a String

Just a snippet which willingly overlooks the fine prints about "strange" characters:

String myString = "Oh what a wonderful string!"
byte[] bytes = myString.getBytes();

No comments: