Below is the code that I use to load a txt file into my program:
[code]
FileInputStream fis = new FileInputStream(“test.txt”);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
List<String> list = new ArrayList<String>();
String data;
while ((data = br.readLine()) != null)
{
list.add(data);
}
for (int i = 0; i < list.size(); i++)
{
operationCode = (list.get(i) % 10000) / 100;
operand = list.get(i) % 100;
}
br.close();
test.txt contains a number on each line.
However, I get errors when I try to compile the code. I think it’s because operationCode and operand are defined as integers and I can’t use strings with modulus (at least that’s what the error says). So what can I do?