Hello i keep getting java.lang.IndexOutOfBoundsException in the line if(numList.get(x) == " " && numList.get(x+1) == " "). How do i fix this?
BufferedReader br = null;
String row;
String[] data = null;
List<String> numList = new ArrayList<String>();
BufferedReader csvReader = new BufferedReader(new FileReader("input file lab5.csv"));
while ((row = csvReader.readLine()) != null) {
data = row.split(",");
// do something with the data
for(int x=0; x<data.length; x++) {
numList.add(data[x]);
}
numList.add(" ");
}
System.out.println("Make sure excel file is on src.\nNumbers extracted from file: "+numList);
int n=0;
for(int x=0; x<numList.size(); x++) {
if(numList.get(x) == " " && numList.get(x+1) == " ") {
n = x+1;
break;