Is it possible to sort an array using Arrays.sort() and thereafter have another related array positioned the same as the sorted array for example:
I found some of the concepts introduced in the answers hard to grasp therefore in my own solution resorted to undesirable programming methods as a trade of for code easier to understand and created a bubble sort method and at the end manipulated the second array like so :
String arrNames[] = new String[5];
String arrCellNo[] = new String[arrNames.length];
String arrNamesSorted[] = new String[arrNames.length];
String arrCellNoSorted[] = new String[arrCellNo.length];
System.arraycopy(arrNames, 0, arrNamesSorted, 0, arrNames.length);
System.arraycopy(arrCellNo, 0, arrCellNoSorted, 0, arrCellNo.length);
for (int i = 0; i < arrNamesSorted.length; i++) {
for (int j = 0; j 0) {
String temp = arrNamesSorted[i];
arrNamesSorted[i] = arrNamesSorted[j];
arrCellNoSorted[i] = arrCellNoSorted[j];
arrNames[j] = temp;
}
}
}