Android examples for java.lang:Character
Convert string to ASCII
import java.io.UnsupportedEncodingException; public class Main{ public static byte[] toASCII(String str) { try {/*from ww w . j ava 2 s .c o m*/ return str.getBytes("US-ASCII"); } catch (UnsupportedEncodingException e) { /* Should never happen. */ throw new RuntimeException(e); } } }