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