62,621
社区成员
发帖
与我相关
我的任务
分享
String str = "Test" ;
str = (char)(str.length()) + str;
byte[] b = str.getbytes();
String str = "https://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=3d11cb76-8373-401d-9e9a-a6b24dd73eff3d11cb76-8373-401d-9e9a-a6b24dd73eff" ; //现在长度是134 = 0x86,大于0x7F
str = (char)(str.length()) + str;
byte[] b = str.getbytes();
String str = "https://forum.csdn.net/PointForum/Forum/PostTopic.a"
+ "spx?forumID=3d11cb76-8373-401d-9e9a-a6"
+ "b24dd73eff3d11cb76-8373-401d-9e9a-a6b24dd"
+ "73eff" ; //现在长度是134 = 0x86,大于0x7F
str = (char)(str.length()) + str;
byte[] b = str.getbytes("ISO-8895-1");
for(int i=128;i<256;i++){
byte[] bb=((char)i+"").getBytes();
for(byte b:bb){
System.out.println(b);
}
}
char c='†';//
byte[] b = (c+"").getBytes();
3f 68 74 74 70 3a 2f 2f 66 6f 72 75 6d 2e 63 73 64 6e 2e 6e 65 74 2f 50 6f 69 6e 74 46 6f 72 75 6d 2f 46 6f 72 75 6d 2f 50 6f 73 74 54 6f 70 69 63 2e 61 73 70 78 3f 66 6f 72 75 6d 49 44 3d 33 64 31 31 63 62 37 36 2d 38 33 37 33 2d 34 30 31 64 2d 39 65 39 61 2d 61 36 62 32 34 64 64 37 33 65 66 66 33 64 31 31 63 62 37 36 2d 38 33 37 33 2d 34 30 31 64 2d 39 65 39 61 2d 61 36 62 32 34 64 64 37 33 65 66 66
[code=Java]
我这里的运行结果是正确的
3f 68 74 74 70 3a 2f 2f 66
//楼主要注意getBytes的默认编码是根据系统编码改变的[/code]