I just need another set of eyes, this is driving me crazy.
I have a function that takes an array, and tries to find and remove duplicates by storing unique strings in the temp[]. The code produces an ArrayIndexOutOfBoundsException in the inner for loop. I am not too sure why the inner loop exceeds the array index.
public static String[] removeDup(String[] aStrings){ String[] temp = new String[aStrings.length]; for(int i = 0; i <=temp.length-1;i++){ temp[i] = ""; } for(int i = 0; i < temp.length; i++){ [B] for(int j = i+1; i<temp.length; j++){ if(!aStrings[i].equals(temp[j])) [/B] temp[j] = aStrings[i]; } } return temp; }