Записываю половину в 1 файл
fileOutputStream1.write(byteArray, 0, count/2);
Остаток хочу хачисать в 2 и не получается
fileOutputStream2.flush();package com.javarush.task.task18.task1808;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Разделение файла
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));;
FileInputStream fileInputStream = new FileInputStream(reader.readLine());
FileOutputStream fileOutputStream1 = new FileOutputStream(reader.readLine());
FileOutputStream fileOutputStream2 = new FileOutputStream(reader.readLine());
if (fileInputStream.available() > 0){
byte[] byteArray = new byte[fileInputStream.available()];
int count = fileInputStream.read(byteArray);
if (count % 2 != 0){
fileOutputStream1.write(byteArray, 0, count/2 + 1);
}else{
fileOutputStream1.write(byteArray, 0, count/2);
}
fileOutputStream2.flush();
}
}
}
