package zh.codegym.task.task18.task1822; /* 查找文件中的数据 */ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; import java.util.*; public class Solution { public static void main(String[] args) throws FileNotFoundException, IOException{ InputStreamReader isr = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(isr); String f1 = reader.readLine(); FileInputStream f1_in = new FileInputStream(f1); HashMap<Integer,String> map = new HashMap<Integer, String>(); String temp = ""; while(f1_in.available()>0){ int data = f1_in.read(); if(data!=10){ temp+=(char)data; } else{ String[] tempS = temp.split(" "); map.put(Integer.parseInt(tempS[0]),String.join(" ",tempS)); temp = ""; } } int id = Integer.parseInt(args[0]); System.out.println(map.get(id)); f1_in.close(); } }