Программа работала слишком долго и была закрыта! не проходит проверку Javarush! Кажется эта ошибка бывает когда цикл бесконечный. Но я не думаю что у меня цикл бесконечный!
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 fileName1 = reader.readLine();
String fileName2 = reader.readLine();
String fileName3 = reader.readLine();
FileInputStream fileInputStream = new FileInputStream(fileName1);
FileOutputStream fileOutputStream = new FileOutputStream(fileName2);
FileOutputStream fileOutputStream2 = new FileOutputStream(fileName3);
byte[] buffer1 = new byte[1000];
byte[] buffer2 = new byte[1000];
while (fileInputStream.available()>0){
int count = fileInputStream.read(buffer1,0,fileInputStream.available()/2);
fileOutputStream.write(buffer1,0,count);
}
while (fileInputStream.available()>0){
int count = fileInputStream.read(buffer2,buffer1.length,fileInputStream.available());
fileOutputStream2.write(buffer2,0,count);
}
fileInputStream.close();
fileOutputStream.close();
fileOutputStream2.close();
}
}