Write a code to read two int array lists of size 5 each as input and to merge the two arrayLists, sort the merged array list in ascending order and fetch the elements at 2nd, 6th and 8th index into a new ArrayList and return the final ArrayList.The return type is an ArrayList with elements from 2,6 and 8th index
The return type is an ArrayList with elements from 2,6 and 8th index position.Array index starts from position 0.
Create the Main class which gets two array list of size 5 as input and call the static methodsortMergedArrayList present in the UserMainCode.
Input and Output Format:
Input consists of two array lists of size 5.
The output is an array list.
Note – The first element is at index 0.
Refer sample output for formatting specifications.