public static void main(String[] argv) { String example = "This is an example"; byte[] bytes = example.getBytes(); System.out.println("Text : " + example); System.out.println("Text [Byte Format] : " + bytes); System.out.println("Text [Byte Format] : " + bytes.toString()); ...
将定义byte和赋值写一起,byte[] a=aString.getBytes("UTF8");//为UTF8编码 byte[] b= aString.getBytes("ISO-8859-1");