求解答一下为什么复制文件会报越界异常,但是执行结果文件也已经正确复制了

问题遇到的现象和发生背景

文件正确复制了,但是还是会报越界异常。不知道为什么。

问题相关代码,请勿粘贴截图
import java.io.*;

public class Test03 {
    public static void main(String[] args) throws Exception {
               copy1();

    }

    public static void copy1() throws Exception {
        File f1 = new File("C:\\LeanningFiles\\Test1\\鞠婧祎.jpg");
        File f2 = new File("C:\\LeanningFiles\\yi\\小.jpg");

        FileInputStream fis = new FileInputStream(f1);
        FileOutputStream fos = new FileOutputStream(f2);

        byte[] b = new byte[1024];
        int len;
        while ((len = fis.read(b)) != 0) {
            fos.write(b, 0, len);
        }

        fis.close();
        fos.close();
    }
}

运行结果及报错内容

img

我的解答思路和尝试过的方法
我想要达到的结果

判断错了 不是0 是不等于-1