Java Program to Convert the ArrayList to an array and vice versa