首页 > 代码库 > byte[] 与字符串转换

byte[] 与字符串转换

//取值之后进行
StringBuffer buffer=new StringBuffer();
for (int i = 0; i < enBytes.length; i++)
{
if(i!=0)
{
buffer.append(",");
}
buffer.append(enBytes[i]);
}
System.out.println("加密后的密文:" + buffer.toString());

String[] temp=buffer.toString().split(",");
byte[] b = new byte[temp.length];
for (int i = 0; i < temp.length; i++)
{
b[i] = Byte.parseByte(temp[i]);
}
String s1 = new String(enBytes);

byte[] 与字符串转换