Всё нормально выводит, но валидатор не принемает.
1 Matches 156.27 3400
2 Bread 113.27 3200
3 Milk 13.27 500
4 Bricks 11.27 3
5 Carpet 13.27 340
6234 Car 13.27 30
7 Door 43.25 31200
869 Bell 62.67 3020
9 Snow 95.27 500
10 Fack 03.27 1
package com.javarush.task.task18.task1822;
/*
Поиск данных внутри файла
*/
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Solution {
public static void main(String[] args) throws IOException {
FileInputStream file = new FileInputStream(new BufferedReader(new InputStreamReader(System.in)).readLine());
// FileInputStream file = new FileInputStream("c:\\java\\file1.txt");
byte[] buffer = new byte[file.available()];
file.read(buffer);
byte[] id;
id = args[0].getBytes();
String result = "";
byte[] fileID = new byte[id.length];
int tempi;
for(int i=0; i< buffer.length; i++){
tempi = i;
if(i == 0 || buffer[i-1] == 10 && buffer[i-2] == 13){ // getting id from file
for(int j=0; j < id.length; j++){
fileID[j] = buffer[tempi];
tempi++;
}
}
if(Arrays.equals(id, fileID)){
while( i < buffer.length && buffer[i] != 13){
result = result + (char) buffer[i];
i++;
}
break;
}
}
System.out.println(result);
file.close();
}
}
//13 - carriage return
//10 - new line
//c:\java\file1.txt