byte[] tem1 = {(byte) 0xdb,0x20,(byte) 0xdc,0x20,(byte) 0xea,0x20,0x50,0x32};
for (int v = 0; v < tem1.length; v++) {
System.out.print(tem1);//数组打印
}
System.out.println();
String str1 = "";
StringBuffer sb = new StringBuffer(str1);
for (int a = 0; a < tem1.length; a++) {
sb.append(String.valueOf(tem1[a]));
}
str1 = sb.toString();
System.out.print(str1);String 类型打印
问一下大家 急等 在线等
我用数组打印出来的是
[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57
用String类型打印出来的是
-3732-3632-22328050
我想问一下大家有什么方法 可以打印出和数组一样的乱码
但是类型还是要String 类型
大家帮我一下 谢谢!~!~
for (int v = 0; v < tem1.length; v++) {
System.out.print(tem1);//数组打印
}
System.out.println();
String str1 = "";
StringBuffer sb = new StringBuffer(str1);
for (int a = 0; a < tem1.length; a++) {
sb.append(String.valueOf(tem1[a]));
}
str1 = sb.toString();
System.out.print(str1);String 类型打印
问一下大家 急等 在线等
我用数组打印出来的是
[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57[B@1c78e57
用String类型打印出来的是
-3732-3632-22328050
我想问一下大家有什么方法 可以打印出和数组一样的乱码
但是类型还是要String 类型
大家帮我一下 谢谢!~!~
String s = temp1.toString();
System.out.println(s);
sb.append(tem1[a].toString());
}应该成
public class Test
{
public static void main(String[] args)
{
byte[] tem1 = {(byte) 0xdb,0x20,(byte) 0xdc,0x20,(byte) 0xea,0x20,0x50,0x32};
/*for (int v = 0; v < tem1.length; v++) {
System.out.print(tem1);//数组打印
}*/
System.out.println(tem1);
String s = tem1.toString();
System.out.println(s);
}
}
for (int v = 0; v < tem1.length; v++) {
System.out.printf("0x%02x,",tem1[v]);//数组打印
}不知道是否符合楼主要求