	   import java.io.*;
	   import java.util.*;
	   import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;

public class readfromfile3
{
	
     public static double[] inputdouble(String filename) throws IOException
     {
	 //reading double values from one line of data    
	 BufferedReader fin=new BufferedReader(new FileReader(filename));
     double a[]=inputdouble(fin);
     return a;
     }
     
     public static double[] inputdouble(BufferedReader fin) throws IOException
     { 
	 //reading double values from one line of data     
	 String s1=fin.readLine();      
     StringTokenizer token=new StringTokenizer(s1);
     int n=token.countTokens()-1;
     int m=n+1;
     double a[]=new double[m];
     int j=0;           
     while(token.hasMoreTokens())
     {
     Double ax=new Double(token.nextToken());
     a[j++]=ax.doubleValue();
     }
     return a;
     }
          
     public static String toString(double a[])
     {
	 String s="";
     for(int i=0;i<a.length;i++)
     {s+="a["+i+"] = "+a[i]+"\n";}
     return s;
	 }
               
     	
public static void main(String args[]) throws IOException
{	
  String s1="a1.txt";
  JFileChooser fc=new JFileChooser();
  ExampleFileFilter filter = new ExampleFileFilter();
  filter.addExtension("txt");
  filter.setDescription("text file : .txt");
  fc.setFileFilter(filter);
  if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {File file = fc.getSelectedFile();s1=file.getName(); }
  File f=new File(s1);
  BufferedReader fin=new BufferedReader(new FileReader(f));
  double number[]=inputdouble(fin);
  JOptionPane.showMessageDialog(null,toString(number),"sequential file reading",JOptionPane.PLAIN_MESSAGE);
  System.exit(0);
}
}
