3个回答
展开全部
public class ByteTest {
public static void main(String[] args) {
String str = "Hello world!";
// string转byte
byte[] bs = str.getBytes();
System.out.println(Arrays.toString(bs));
// byte转string
String str2 = new String(bs);
System.out.println(str2);
}
}
public static void main(String[] args) {
String str = "Hello world!";
// string转byte
byte[] bs = str.getBytes();
System.out.println(Arrays.toString(bs));
// byte转string
String str2 = new String(bs);
System.out.println(str2);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询