System.out.println("Please choose an option to forsort the following stats");
System.out.println("A.Player's j=0;Name");
System.out.println("B.Player's FG%");
System.out.println("C.Player's 3P%");
System.out.println("D.Player's FT%");
System.out.println("E.Player's REB");
System.out.println("F.Player's AST");
System.out.println("G.Player's PTS");
if(player.equalsIgnoreCase("A"))
{
for (int int x=1;x<s.length;++x)
{
for (int y=1;y<s.length-1;++y)
if (s[y][0].compareTo(s[y+1][0])>0)
{
String temp[]=s[y];
s[y]= s[y+1];
s[y+1]=temp;
}
}
}
}
}
For example, if user presses a, I want it to sort by player's name only and also I get an error for stats[j][i]=temp[i]; saying that java.lang.ArrayIndexOutOfBoundsException: 6. I don't know why I keep on getting this error?
Below is my data text file, players' names are in column 0, Lou, Kyle, Patrick and more... Because if I just get this I can sort the other ones easily?
Lou Williams,41.1,36.3,87.6,60,53,508
Kyle Lowry,44.9,35.1,81.3,160,260,702
Patrick Patterson,48.8,46.0,75.0,177,61,286
Terrence Ross,42.9,38.7,87.9,119,30,411
Jonas Valanciunas,54.2,0.0,79.2,283,16,414
Amir Johnson,57.8,38.9,60.0,171,47,295
James Johnson,58.3,19.4,65.7,129,46,247
Demar Derozan,39.4,25.0,82.3,67,42,310
Landry Fields,52.9,50.0,83.3,22,13,42
Greivis Vasquez,38.7,31.7,71.1,81,119,321