Linha por linha.
Nome: Lista.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
public class Lista {
public ArrayList lerArquivo(){
ArrayList
File afile = new File ("valores.txt");
FileReader fileread = null;
BufferedReader bufread = null;
try {
fileread = new FileReader(afile);
bufread= new BufferedReader(fileread);
String str = new String();
while( (str = bufread.readLine()) != null ){
lista.add(str);
}
}catch (Exception e) {
e.printStackTrace();
}finally{
if (fileread != null) {
try {
fileread.close();
} catch (Exception e){}
}
if (bufread != null){
try {
bufread.close();
} catch (Exception e){}
}
return lista;
}
}
}