gpt4 book ai didi

java - 将 while 循环更改为 for 循环

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:35:26 25 4
gpt4 key购买 nike

我正在尝试将此 while 循环更改为 for 循环,但我并没有取得太大进展。我是编程新手,如果这是一项微不足道的任务,我深表歉意。

while (read < fileBytes.length
&& (numRead = diStream.read(fileBytes, read, fileBytes.length - read)) >= 0)
{
read = read + numRead;
}

最佳答案

尝试使用这个:

start_value = //....
for (read = start_value; read < fileBytes.length
&& (numRead = diStream.read(fileBytes, read, fileBytes.length - read)) >= 0;
read += numRead) {

//Your actions

}

关于java - 将 while 循环更改为 for 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43686408/

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