Подскажите в чём ошибка?
package com.javarush.task.pro.task15.task1504;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;
/*
Перепутанные байты
*/
public class Solution {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
try (InputStream input = Files.newInputStream(Path.of(console.nextLine()));
OutputStream output = Files.newOutputStream(Path.of(console.nextLine()))) {
byte[] array = input.readAllBytes();
byte[] copy = new byte[array.length];
int length;
if (array.length %2 != 0) {
copy[array.length - 1] = array[array.length - 1];
length = array.length - 1;
} else {
length = array.length;
}
for (int i = 0; i < length; i++) {
System.out.println(Arrays.toString(array));
System.out.println(Arrays.toString(copy));
}
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}