I'm currently doing selection sort and this is my method to sort a array of string into alphabet order. I interpret the code line by line into words and test it by hand it seem to make sense but when I run it, the array won't be in order. Can anyone help me find where I went wrong? Thanks

Code :

public static void sortTitles(Movie3[]list ) { //Movie3 [] dest = new Movie3[list.length]; Movie3 temp; int max ; for(int x = list.length-1 ; x > 0 ;x--) { String next = list[x].getTitle(); max = x; for(int i = 0 ; i < x ;i++) { if((next.compareTo(list[i].getTitle())) > 0 ) { max = i ; } } temp = list[x]; list[x] = list[max]; list[max] = temp; } }