Skip to content

Instantly share code, notes, and snippets.

@bastienapp
Created March 21, 2019 10:48
Show Gist options
  • Save bastienapp/adcae39004b93fdc4b3735384b4cdfef to your computer and use it in GitHub Desktop.
Save bastienapp/adcae39004b93fdc4b3735384b4cdfef to your computer and use it in GitHub Desktop.
class SortArray {
public static int[] sort(int[] tableInt){
for(int j = 0; j < tableInt.length - 1; j++) {
int minValue = tableInt[j];
int index = j;
for (int i = j + 1; i < tableInt.length; i++){
if (minValue > tableInt[i]) {
minValue = tableInt[i];
index = i;
}
}
tableInt[index] = tableInt[j];
tableInt[j] = minValue;
}
return tableInt;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment