private int[] Splitter(String unSortedElements){
//Use split method to put the String into String array separated with " " delimeter
String[] stringParts = unSortedElements.split(" ");
//Convert String array to int array
int[] inputs = new int[stringParts.length];
for (int i=0; i < stringParts.length; i++) {
inputs[i] = Integer.parseInt(stringParts[i]);
//System.out.println(inputs[i]);
}
return inputs;
}
private int[] doSelectionSort(int[] unSortedElements){
int i,j,minIndex, tmp;
int n = unSortedElements.length;
int arr4[] = Splitter(inputsjTextField.toString());
for(i=0; i<n; i++){
minIndex = i;
for(j=i+1; j<n; j++ ){
if(unSortedElements[j] < unSortedElements[minIndex]){
minIndex = j;
}
if(minIndex != i){
tmp = unSortedElements[i];
unSortedElements[i] = unSortedElements[minIndex];
unSortedElements[minIndex] = tmp;
}
}
}
return arr4;
}