1、string 转 byte[]
String.getBytes(String decode)方法会根据指定的decode编码返回某字符串在该编码下的byte数组表示
String s= "Zhidao";
byte[] b= s.getBytes();
2、byte[] 转 string
直接通过构造函数,将byte[]数据转成string
byte[] b;
String s= new String(b);
byte--> String :s= new String(byte);
String-->byte: byte[] b=s.getBytes();
String s=new String(byte[]);