I have a loop that initiates an array of strings then cuts them to give the desired information:
for (Element referenceId: referenceIds){
ref[i] = referenceId.attr("href");
String[] str = new String[24];
str[i] = ref[i].substring(ref[i].lastIndexOf("listing-") + 8, ref[i].indexOf(".htm"));
System.out.println(str[i]);
i++;
}
However I'm getting an error crashing the program:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 24
at Jobs.main(Jobs.java:30)
What is this and how do I fix it? I've tried changing the array size to less but that didn't work.