-
byte数组转化为String:
- byte [] bMsg = {xx, xx, xx, ……}; //假设编码方式为"UTF-8"
- String str = new String(bMsg, "UTF-8" );
String转化为byte数组:
- String str = "123" ;
- byte [] bMsg = str.getBytes( "UTF-8" ); //假设编码方式为"UTF-8"
byte数组转化为String:
String转化为byte数组: