Не проходит валидацию: public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String fileName = reader.readLine(); int id = Integer.parseInt(args[0]); //String fileName = "C:\\Users\\Миша\\JavaRushTasks\\2.JavaCore\\src\\com\\javarush\\task\\task18\\task1822\\Veniamin"; //int id = 78; String[] array = readFile(fileName); for (int i = 0; i < array.length; i++) { stringProcess(id, array[i]); } } private static void stringProcess(int id, String str) { int id1 = 0; String productName = ""; double price = 0.00; int quntity = 0; str = str.replace("\r", " "); str = str.trim(); try { String[] array1 = str.split(" "); if (Integer.parseInt(array1[0]) == id) { for (int i = 1; i < array1.length - 2; i++) { productName = productName + array1[i] + " "; } id1 = Integer.parseInt(array1[0]); price = Double.parseDouble(array1[array1.length - 2]); quntity = Integer.parseInt(array1[array1.length - 1]); //System.out.print(id1); System.out.print(" "); System.out.print(productName); System.out.print(price); System.out.print(" "); System.out.print(quntity); } } catch (NumberFormatException e) { System.out.println("NumberFormatException has been caught"); e.printStackTrace(); } } private static String[] readFile(String fileName) throws IOException{ String s = ""; InputStream inputStream = new FileInputStream(fileName); try { while (inputStream.available() > 0) { s = s + (char) inputStream.read(); } }catch (IOException ioe){ ioe.printStackTrace(); } finally { inputStream.close(); } String[] array = s.split("\n"); return array; }