• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.
  1. Boards
  2. Code Hunter
  3. Bandit Keith

User Info: Kyoto

Kyoto
11 years ago#1
Bandit Keith.
Brawl Friend Code: 1246-8395-4828

User Info: Kyoto

Kyoto
11 years ago#2
public void sortByTitle(){
for(int i = 1; i < count; i++){
if(findMinTitle(tunes[i-1], (tunes[i]))== true){
swap(i-1, i);
}
}
}



public void sortByArtist(){
for(int i = 1; i < count; i++){
if(findMinArtist(tunes[i-1], (tunes[i]))== true){
swap(i-1, i);
}
}
}



public void shuffle(){
for(int i = 0; i < tunes.length; i++){
swap(i, ((int)(count * Math.random())));
}
}



public void reverse(){
for(int i = 0; i < count/2; i++){
swap(i, tunes.length-1-i);
}
}



public static boolean findMinTitle(Tune tune1, Tune tune2){

if(tune2.getTitle().compareToIgnoreCase(tune1.getTitle()) < 0){
return true;
}

else return false;
}



public static boolean findMinArtist(Tune tune1, Tune tune2){

if(tune2.getArtist().compareToIgnoreCase(tune1.getArtist()) < 0){
return true;
}

else return false;
}
  1. Boards
  2. Code Hunter
  3. Bandit Keith
  • Topic Archived