public class InsertionSort { public static void insertionSort(int[] arr) { for (int j = 1; j < arr.length; j++) { int key = arr[j]; int i = j - 1; while (i >= 0 && arr[i] > key) { arr[i + 1] = arr[i]; i = i - 1; } arr[i + 1] = key; } } public static void main(String[] args) { int[] numbers = {22, 3 ,5 ,10 ,11 ,23 ,7 ,1 ,2 ,4}; System.out.println("Original Array:"); printArray(numbers); insertionSort(numbers); System.out.println("Sorted Array:"); printArray(numbers); } public static void printArray(int[] arr) { for (int num : arr) { System.out.print(num + " "); } System.out.println(); } }