Help please why it doesnt work ?
package com.codegym.task.task18.task1822;
/*
Finding data inside a file
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileInputStream fileInputStream = new FileInputStream(reader.readLine());
BufferedReader bufferedInputStream = new BufferedReader(new InputStreamReader(fileInputStream));
String searchedId = args[0].toString();
while(bufferedInputStream.ready()){
String line = bufferedInputStream.readLine();
String[] lineUpdated = line.split(" ",2);
if(lineUpdated[0].contains(searchedId)){
System.out.println(lineUpdated[1]);
}
}
reader.close();
fileInputStream.close();
bufferedInputStream.close();
}
}
/*
Read a file name from the console.
Search the file for information related to the specified id. Display it in the format used in the file.
The program is started with one argument: id (an int).
Close the streams.
The file data is separated by spaces and stored in the following order:
id productName price quantity
where id is an int
productName is a String — it can contain spaces
price is a double
quantity is an int
The information for each product is stored on a separate line.
Przeczytaj nazwę pliku z konsoli.
Wyszukaj w pliku informacje związane z określonym identyfikatorem. Wyświetl go w formacie użytym w pliku.
Program uruchamiany jest z jednym argumentem: id (int).
Zamknij strumienie.
Dane pliku są oddzielone spacjami i przechowywane w następującej kolejności:
id productName cena ilość
gdzie id jest int
nazwa_produktu jest ciągiem znaków - może zawierać spacje
cena jest podwójna
ilość jest liczbą całkowitą
Informacje dla każdego produktu są przechowywane w osobnej linii.
*/