Не знаю как самому протестировать программу, по второму пункту не проходит, что я делаю не так?
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;
/*
Перепутанные байты
*/
public class Solution {
public static void main(String[] args) throws IOException {
//напишите тут ваш код
Scanner console = new Scanner(System.in);
String src = console.nextLine();
String dest = console.nextLine();
try (
InputStream input = Files.newInputStream(Path.of(src));
OutputStream output = Files.newOutputStream(Path.of(dest)))
{
byte[] bytes = input.readAllBytes();
byte[] buffer = new byte[bytes.length];
while (input.available() > 0)
{
if (bytes.length % 2 == 0)
{
for (int i = 0; i < bytes.length; i++)
{
byte temp = bytes[i];
buffer[i] = bytes[i+1];
buffer[i+1] = temp;
}
}
else if (bytes.length % 2 != 0)
{
for (int i = 0; i < bytes.length - 1; i++)
{
byte temp = bytes[i];
buffer[i] = bytes[i+1];
buffer[i+1] = temp;
}
buffer[bytes.length-1] = buffer[bytes.length-1];
}
output.write(buffer);
}
}
}
}