I am trying to sort my array to print it out according to the suits e.g. S10, S6, H11, C4, D10 etc. I have tried adding Arrays.sort but it doesnt work. Please advice.
private void transfer2D(String[][] twoD, String[] strArray)
{
int i = 0;
for( int suit = 0; suit < 4; suit++ )
{
for( int rank = 0; rank < 13; rank++ )
{
twoD[suit][rank] = strArray[i++];
}
}
}
private void print2D_1(String[][] twoD)
{
int count = 0;
System.out.println("Rearrange the cards - 1");
System.out.println();
for(int suit = 0; suit < 4; suit++)
{
for(int rank = 0; rank < 13; rank++ )
{
Arrays.sort(twoD);
System.out.print(" " + twoD[suit][rank]);
}
System.out.println();
}
}