Java tutorial
import java.io.UnsupportedEncodingException; import java.util.Arrays; public class Main { public static void main(String[] args) throws UnsupportedEncodingException { String s = "Hello world"; byte[] b = s.getBytes("US-ASCII"); System.out.println(Arrays.toString(b)); } }