где я мог ошибиться?
package com.javarush.task.pro.task15.task1504;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
import java.io.IOException;
/*
Перепутанные байты
*/
public class Solution {
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
try {
Path src = Path.of(console.nextLine());
Path desk = Path.of(console.nextLine());
InputStream input = Files.newInputStream(src);
OutputStream output = Files.newOutputStream(desk);
byte[] buffer = input.readAllBytes();
for (int i = 0; i < buffer.length - 1; i += 2) {
byte temp = buffer[i];
buffer[i] = buffer[i + 1];
buffer[i + 1] = temp;
}
if (buffer.length % 2 != 0 && buffer[buffer.length - 1] % 2 != 0) {
output.write(buffer[buffer.length - 1]);
} else {
output.write(buffer);
}
input.close();
output.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}