Java Use Data from External Text File -


I have a test file in which there are first 1000 prime numbers and I have said that to read data from a text file The method is written.

How would I like to use the data from this file and I would like to apply it to any other method.

On the lines of this:

  read the data from the file; Use the first eight numbers and apply this method;   

Any help would be appreciated.

Simple to read from the file, suppose you have one line per line -

  BufferedReader br = new buffed reader (new FileReader ("& lt; your-text-file & gt;")); String TST Pneumatic; While {(txtNum = br.readline ()) = = null {// txtNum has been read, use it though (txtNum.length ()> 8) {thisMethod (txtNum.substring (0, 8) )); }}    

Comments