farm ostrich :
How to convert a Java String to an ASCII byte array?
Sebastian Paaske Tørholm :
Using the getBytes
method, giving it the appropriate Charset
(or Charset
name).
Example:
String s = "Hello, there.";
byte[] b = s.getBytes(StandardCharsets.US_ASCII);
(Before Java 7: byte[] b = s.getBytes("US-ASCII");
)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments