Hi, not exactly sure what's wrong. I have tested it and it works fine. Maybe I should have used only FileOutputStream instead of PrintStream (I found the other much easier). I closed all streams and yet I get errors:
"Server security exception. You are performing a forbidden or potentially dangerous operation."
package pl.codegym.task.task18.task1820;
/*
Zaokrąglanie liczb
*/
import java.io.*;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;
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();
FileInputStream inputStream = new FileInputStream(fileName1);
FileOutputStream outputStream = new FileOutputStream(fileName2);
outputStream.close();
Scanner lines = new Scanner(inputStream);
String doubles = "";
while (lines.hasNext()){
doubles = lines.nextLine();
}
inputStream.close();
//System.out.println(doubles);
String[] doubleTable = doubles.split(" ");
double number = 0.00;
int liczby = 0;
PrintStream printStream = new PrintStream(fileName2);
for (int i = 0; i < doubleTable.length; i++){
number = Double.parseDouble(doubleTable[i]);
liczby = (int) Math.round(number);
printStream.print(liczby + " ");
//System.out.println(liczby);
}
printStream.close();
}
}