Need help
package com.codegym.task.task18.task1808;
/*
Splitting a file
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
//Requirements 1,2 --> start initialization using File streams
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String file1 = r.readLine();
String file2 = r.readLine();
String file3 = r.readLine();
FileInputStream in = new FileInputStream(file1);
FileOutputStream out1 = new FileOutputStream(file2);
FileOutputStream out2 = new FileOutputStream(file3);
int half = (in.available() / 2); //gets half
byte[] buffer1;
byte[] buffer2;
// end init
// Preparing buffers for input
if (in.available() % 2 != 0)
half++;
buffer1 = new byte[half];
// 3,4 reading and writing halves of bytes
boolean moveOn = false;
while (!moveOn) {
in.read(buffer1);
if (buffer1[half - 1] != 0) ;
moveOn = true;
}
in.read((buffer2 = new byte[in.available()]));
out1.write(buffer1);
out2.write(buffer2);
// end 3,4
//5 close streams
in.close();
out1.close();
out2.close();
}
}