Convert String to byte array

This little code example shows a String to byte array conversion.
The String class has a method called getBytes which returns an array of bytes.
In the example the length of the array is printed out to illustrate that the length of the array is the same as the number of characters in the String.

When executed, the code will output the length of the array: 76

Check out this link to convert byte array to String

Search for more Java info on this site here:
Custom Search

Please type any questions here.