public static void workedHoursSort (int[][] totalHours) { for (int i = totalHours[0].length - 1; i >= 1; i--) { int currentMax = totalHours[0][0]; int currentMaxIndex = 0; for(int j = 1; j <= i; j++) { if(currentMax < totalHours[0][j]) { currentMax = totalHours[0][j]; currentMaxIndex = j; } } if (currentMaxIndex != i) { totalHours[0][currentMaxIndex] = totalHours[0][i]; totalHours[0][i] = currentMax; //totalHours[1][i] = currentMaxIndex; } } }