import java.io.FileInputStream;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.EOFException;
import java.util.Hashtable;
public class LeerRegistros {
public static void main(String [] args) {
    FileInputStream in;
    Hashtable registros = new Hashtable();
    try {
        in = new FileInputStream("registros.dat");
        DataInputStream dIn = new DataInputStream(
          new BufferedInputStream(in,512));
        boolean salir = false;
        while (!salir) {
           try {
             int valor = dIn.readInt();
             double d = dIn.readDouble();
             System.out.println("==>"+valor+" "+d);
             registros.put(new Integer(valor),new Double(d));
           } catch (EOFException ex) { salir=true;}
        }
        dIn.close();in.close();
        //hacer consulta, leer el registro 6000
        int llave = 6000; 
        Double contenido =
        (Double) registros.get(new Integer(llave));
        System.out.println( contenido.doubleValue());
    } catch (FileNotFoundException ex) {
	ex.printStackTrace();
        System.exit(0);
    } catch (IOException ex) {
	ex.printStackTrace();
        System.exit(0);
   }//try
  }//main 
}