Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SpiritOfDarkDragon/eff8288e4e91d1132fb7 to your computer and use it in GitHub Desktop.
Save SpiritOfDarkDragon/eff8288e4e91d1132fb7 to your computer and use it in GitHub Desktop.
//Convert from String to byte[]:
String s = "some text here";
byte[] b = s.getBytes("US-ASCII");
//Convert from byte[] to String:
byte[] b = {(byte) 99, (byte)97, (byte)116};
String s = new String(b, "UTF-8");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment