How can I read inputs (letters, numbers) from my file.txt wherein it reads infinitely but only stops when it encounters special symbols? At the same time when it is numbers i.e
123,345,abc
it should translate the ascii code and add the 2 values that results as 123 + 345 = 468
EDITED QUESTION
Here's my code; I really had a problem with reading those bytes in my file.txt. I want to convert its value where Isimilarly added it in my file.txt
public class .... {
static char tmp = 0;
public static void main(String[] args) {
try {
Reader myReader = new FileReader("MyFolder/myFile2.txt");
List<Character> myList = new ArrayList<Character>();
/*for(int myData = myInputStream.read();
myData != -1;
myData = myInputStream.read()){
System.out.print(" " + (char)myData);
}*/
for(int myData = myReader.read();
myData != -1;
myData = myReader.read()){
if((char)myData != ','){
myList.add((char)myData);
}
else{
continue;
}
}
for(Character i: myList)
{
tmp = 1;
}
String myString = String.valueOf(tmp);
int num1 = Integer.parseInt(myString);
int num2 = Integer.parseInt(myString);
int equal = num1 + num2;
System.out.print(equal);
myReader.close();
}
catch(FileNotFoundException e){
}
catch(IOException e){
}
}
}