Нужна помощь, не проходит валидацию. Не вижу ошибки.. Хелп
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 f1 = reader.readLine();
String f2 = reader.readLine();
String f3 = reader.readLine();
FileInputStream file1 = new FileInputStream(f1);
int data = 0;
long sum = 0;
while (file1.available() > 0) {
//1. Посчитали количество байт
data = file1.read();
sum += data;
}
// 2. Узнаем сколько байт будем записывать в
int countSecF;
if (sum % 2 == 0) {
countSecF = (int) (sum / 2);
} else countSecF = (int) (sum / 2) + 1;
//3. записываем
FileOutputStream file2 = new FileOutputStream(f2);
FileOutputStream file3 = new FileOutputStream(f3);
int countRed = 0;
while (file1.available() > 0) {
int r = file1.read();
countRed++;
if(countRed<=countSecF){
file2.write(r);
}else file3.write(r);
}
file1.close();
file2.close();
file3.close();
}
}