Подскажите что не так делаю. Не принимается второе условие
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.Path;
import java.nio.file.Paths;
import java.util.Scanner;
/*
Перепутанные байты
*/
public class Solution {
public static void main(String[] args) throws IOException {
try (Scanner scanner = new Scanner(System.in)) {
try (var input = Files.newInputStream(Paths.get(scanner.nextLine()));
var output = Files.newOutputStream(Paths.get(scanner.nextLine()))) {
byte[] array = input.readAllBytes();
byte[] array1 = new byte[array.length];
while (input.available() > 0) {
if (input.available() != 1) {
int a = input.read();
int b = input.read();
// int temp = b; b = a; a = temp;
output.write(b);
output.write(a);
} else {
int a = input.read();
output.write(a);
}
}
}
}
}
}