Проверял, файлы верно заполняются, но валидация не проходит.
package com.javarush.task.task18.task1808;
import java.io.*;
/*
Разделение файла
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader fileNameReader = new BufferedReader(new InputStreamReader(System.in));
String sourceFile = fileNameReader.readLine();
String firstDestinationFile = fileNameReader.readLine();
String secondDestinationFile = fileNameReader.readLine();
fileNameReader.close();
byte[] bytes;
try (FileInputStream fileSource = new FileInputStream(sourceFile);
FileOutputStream fileDestinationFirst = new FileOutputStream(firstDestinationFile);
FileOutputStream fileDestinationSecond = new FileOutputStream(secondDestinationFile)) {
bytes = new byte[fileSource.available()];
int readBytes = fileSource.read(bytes);
System.out.println(readBytes);
int board = readBytes / 2;
fileDestinationFirst.write(bytes, 0, board);
fileDestinationSecond.write(bytes, board, readBytes - board);
}
}
}