public void shellSort(int[] arr) { for (int gap = arr.length / 2; gap > 0; gap /= 2) for (int i = gap; i < arr.length; i++) if (arr[i - gap] > arr[i]) { int temp = arr[i]; int j = i - gap; for (; j >= 0 && arr[j] > temp; j -= gap) arr[j + gap] = arr[j]; arr[j + gap] = temp; } }