I currently have a selection sorting algorithm, but need some help turning it into a insertion sort, I understand a insertion sort if faster? The hand array is full, and it needs to sort from lowest to highest rank.
private void sort(PlayingCard[] hand)
{
PlayingCard temp;
for(int i = 0; i < hand.length ; i++)
{
for(int j = i+1; j < hand.length ; j++)
{
int compareRank = hand[j].getRank().compareTo(hand[i].getRank());
if(compareRank < 0){
temp = hand[i];
hand[i] = hand[j];
hand[j] = temp;
}
}
}
}
Arrays.sort
implementation? \$\endgroup\$