Правильное решение куда короче и изящнее, не спорю.
Но мне очень интересно, почему мое решение не принимает валидатор.
package com.javarush.task.task18.task1822;
import java.io.*;
/*
Поиск данных внутри файла
*/
public class Solution {
public static void main(String[] args) throws IOException {
try (BufferedReader bis = new BufferedReader(new InputStreamReader(System.in))) {
String nameFile = bis.readLine();
FileReader f1 = new FileReader(nameFile);
//String g ="194";
String strText = "";
String strId = "";
File file = new File(nameFile);
char[] bytes = new char[(int)file.length()];
f1.read(bytes);
f1.close();
char endS = '\n';
for (int i = 0; i <bytes.length ; i++) {
if(!String.valueOf(bytes[i]).equals(" ")){
strId = strId + String.valueOf(bytes[i]);
} else {
//if (g.equals(strId)){
if (args[0].equals(strId)){
//System.out.print(g);
//System.out.print(args[0]);
for (int j = i; j < bytes.length ; j++) {
if (endS != bytes[j]) {
//System.out.print(String.valueOf(bytes[j]));
strText = strText + String.valueOf(bytes[j]);
} else {
break;
}
}
break;
}
strId = "";
}
}
//System.out.println(g + " " + strText.trim());
System.out.println(args[0] + " " + strText);
}
}
}