/* Problem 1, Lab 9, Wednesday 22nd October Create an array A of length 2n + 1 which will store integers, the value of n is to be provided from command line. Fill the array with random integers from range 0 to 1000. Print the array A. Rearrange the elements of A so that A[n] stores the smallest element. A[n − 1] stores the second smallest element A[n + 1] stores the third smallest element and so on ... */ public class Array1 { public static void main(String[] args) { if(args.length != 1) { System.out.println("Invalid Command line arguements."); return; } int n; try { n = Integer.parseInt(args[0]); } catch(NumberFormatException ex) { System.out.println("Invalid Command line arguements."); return; } int A[] = new int[2*n+1]; for(int i=0;i-1 && B[j] > temp;j--) B[j+1] = B[j]; B[j+1] = temp; } A[n] = B[0]; for(j=1;j<=n;j++) { A[n-j] = B[2*(j-1)+1]; A[n+j] = B[2*(j-1)+2]; } System.out.print("A ::\t"); for(int i=0;i