1、string转化为byte[]数组
String str = "abcd";
byte[] bs = str.getBytes();
2、byte[]数组转化为string字符串
/*String str1 = "abcd";
byte[] bs1 = str1.getBytes();*/
byte[] bs1 = {97,98,100};
String s = new String(bs1);
3、设置格式
byte[] srtbyte = {97,98,98};
String res = new String(srtbyte,"UTF-8");