This is the following, I'm using this method to read my txt file.
public String lerArquivo2() throws FileNotFoundException, IOException {
FileInputStream input = context.openFileInput("teste46a.txt");
int byteLido = 0;
StringBuffer str = new StringBuffer();
while ((byteLido = input.read()) != -1) {
str.append((char) byteLido);
}
System.out.print(str);
return str.toString();
}
And within this txt are the numbers 7.0 6.5 6.0 12.0 I need to add all these numbers the final result would have to be 31.5.
How can I do this?