Не проходит
package com.javarush.task.task18.task1822;
/*
Поиск данных внутри файла
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String Filename1 = bufferedReader.readLine();
// String Filename1 = "C:/Users/Valerkina Java/Desktop/1.txt";
FileInputStream fileInputStream = new FileInputStream(Filename1);
Integer id = null;
try {
id = Integer.parseInt(args[0]);
} catch (Exception e) {
e.printStackTrace();
}
StringBuilder allchar = new StringBuilder();
while (fileInputStream.available() > 0) {
char d = (char) fileInputStream.read();
allchar.append(d);
}
// System.out.println( " allchar = " + allchar);
fileInputStream.close();
String[] arraystring = allchar.toString().split("\n");
String[] allarraystringresult = new String[ arraystring.length ];
/*for (String valuestring : arraystring) {
System.out.println("valuestring = " + valuestring);
}*/
Integer digitint = null;
for (int i = 0; i < allarraystringresult.length; i++) {
// int limit = arraystring[i].indexOf(" ");
allarraystringresult[i] = arraystring[i].substring(0, arraystring[i].indexOf(" ") );
// System.out.println( "arraystring[i] =" + arraystring[i] );
// System.out.println( "allarraystringresult[i] =" + allarraystringresult[i] );
try {
digitint = Integer.parseInt(allarraystringresult[i] );
if (id == digitint) {
System.out.println( arraystring[i] );
return;
}
} catch (Exception e) {
System.out.println("Ne chislo");
}
}
}
}