View Single Post
  #5 (permalink)  
Old 05-13-2008, 02:13 PM
masaka masaka is offline
Member
 
Join Date: Mar 2008
Posts: 31
masaka is on a distinguished road
what is your opion of this code and is there another way to do this?
this only the method used to sort the two arrayes
Code:
public void sort(String[] names, int[] grade){ boolean swapped; do{ swapped = false; for (int i = 0; i < names.length-1; i++) { if(names[i].compareToIgnoreCase(names[i+1])>0){ String temp = names[i+1]; names[i+1] = names[i]; names[i] = temp; int temp1 = grade[i+1]; grade[i+1] = grade[i]; grade[i] = temp1; swapped=true; } } }while(swapped); }
Reply With Quote