gpt4 book ai didi

java - 处理字节数组产生奇怪结果的字符串构造函数

转载 作者:行者123 更新时间:2023-11-29 05:23:28 24 4
gpt4 key购买 nike

<分区>

我正在使用处理字节数组的隐式字符串构造函数..但结果很奇怪。我是否需要为正确的输出做更多的事情......?任何帮助将不胜感激。这是我的代码..

    byte[] arr = { 23, 34, 20, 65, 88, 95 };

String s1 = new String(arr);
System.out.println("First: "+s1);

String s2 = new String(arr, 1, 3);
System.out.println("Second: "+s2);

它打印:

First: ?"?AX_

Second: ?AX

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com