Possible Duplicate:
Selection Sorting String Arrays (Java)
I have a list of cards
clubsArray = {TC, KC, 7C, AC}
These stand for (ten of clubs, king of clubs, 7 of clubs and ace of clubs) I want to know how to sort them and get an output like this,
AC, KC, TC, 7C
I tried doing this to sort it ...
private String clubsOutput = "";
public void clubsSort()
{
String order = {"A","K","Q","T","9","8","7","6","5","4","3","2","1"};
for (int i = 0; i < clubsArray.length; i++)
{
temp = clubsArray[i].charAt(0); // Gets the value of the card
tempS = Character.toString(temp); // Holds the character
for (int x = 0; x < order.length; x ++)
{
if (tempS.equals(order[x])
{
clubsOutput = clubsOutput + clubsArray[i]+ " , ";
}
}
i cant seem to solve this