()
| 49 | public class Sort012 { |
| 50 | |
| 51 | public static int [] takeInput() { |
| 52 | Scanner sc = new Scanner(System.in); |
| 53 | System.out.println("Enter the length of the array: "); |
| 54 | int n = sc.nextInt(); |
| 55 | int [] arr = new int[n]; |
| 56 | |
| 57 | for (int i = 0; i < n; i++) { |
| 58 | System.out.println("Enter the element at " + i + " th index."); |
| 59 | arr[i] = sc.nextInt(); |
| 60 | } |
| 61 | return arr; |
| 62 | } |
| 63 | public static void swap(int [] arr, int i, int j) { |
| 64 | // i = number to be swapped. |
| 65 | // j = number with which it is swapped. |