1. 程式人生 > >java中位元組陣列轉換為字串

java中位元組陣列轉換為字串

1、位元組陣列轉換為字串
byte[] byBuffer = new byte[20];
... ...
String strRead = new String(byBuffer);
strRead=String.copyValueOf(strRead.toCharArray(), 0, byBuffer.length]);
2、字串轉換成位元組陣列
byte[] byBuffer = new byte[200];
String strInput="abcdefg";
byBuffer= strInput.getBytes();