Covert String to byte array

We can use String class getBytes() method to encode the string into a sequence of bytes using the platform’s default charset. This method is overloaded and we can also pass Charset as argument.
Here is a simple program showing how to convert String to byte array in java.

Leave a Reply

Your email address will not be published. Required fields are marked *