Всё проверил, но не могу понять что не так(((
package com.javarush.task.task18.task1808;
/*
Разделение файла
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String name1 = reader.readLine();
String name2 = reader.readLine();
String name3 = reader.readLine();
FileInputStream inputStream = new FileInputStream(name1);
FileOutputStream outputStream1 = new FileOutputStream(name2);
FileOutputStream outputStream2 = new FileOutputStream(name3);
byte[] buffer = new byte[inputStream.available()];
while (inputStream.available() > 0) {
int count = inputStream.read();
int half = count / 2;
if (count % 2 == 0) {
outputStream1.write(buffer, 0, half);
outputStream2.write(buffer, half + 1, count);
} else {
outputStream1.write(buffer, 0, half + 1);
outputStream2.write(buffer, half + 2, count);
}
}
inputStream.close();
outputStream1.close();
outputStream2.close();
}
}