Sorting array elements

Best method for this would be Insertion Sort, to make sure you put them into the array at the right position instead of doing it after the fact. Basically it goes each time you add something to the array you search it and find the correct position, in this case you would be looking for a class comparison and if its the right spot insert it into the array at that position shifting the other items index.

Maybe this method isnt good for you though, you might need to provide abit more details on what youre trying to accomplish with said array, cool.