I can't really know where could be other problems since I can't even validate the first condition even tho when I test it it's obviously working juste fine for that part.
If there are still people on the website since payment, can I have help?
package com.codegym.task.task18.task1825;
import java.io.*;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Set;
import java.util.TreeSet;
/*
Building a file
*/
public class Solution {
public static void main(String[] args) throws Exception{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileInputStream fileInputStream = null;
BufferedInputStream bufferedInputStream =null;
FileOutputStream fileOutputStream = null;
BufferedOutputStream bufferedOutputStream = null;
String fileFinal = null;
String filePart = null;
HashMap<Integer, String> map = new HashMap<>();
while (true) {
filePart = reader.readLine();
if (filePart.equals("end")){
break;
}
else {
String[] temp = filePart.split(".Part");
map.put(Integer.parseInt(temp[1]), filePart);
fileFinal = temp[0];
}
}
fileOutputStream = new FileOutputStream(fileFinal, true);
bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
for (int i = 1; i < map.size()+1; i++) {
String temp = map.get(i);
fileInputStream = new FileInputStream(temp);
bufferedInputStream = new BufferedInputStream(fileInputStream);
byte[] data = new byte[bufferedInputStream.available()];
while (bufferedInputStream.available()>0){
bufferedInputStream.read(data);
bufferedOutputStream.write(data);
}
}
reader.close();
fileInputStream.close();
fileOutputStream.close();
bufferedInputStream.close();
bufferedOutputStream.close();
}
}