Computers and Technology

create a static void method that takes an arraylist as its input parameter and outputs each element of the arraylist to the screenyou can use this function as a template to get started: public static void printlist(arraylist list)you are required to iterate through the list. you may use an iterator or a for loop, but go through the list and print each item.do not simply call system.out.println(list); this will not receive full credit.in the main method:create an arraylist of doublesadd the following values to the list in this order1.5 - first value2.35 - second value-4.7 - third value0.01 - fourth valueprint the list using the printlist method designed in step 1.sort the list by calling the collections.sort methodthis method takes a single parameter, the list you want sorted.there is an option for a second parameter, the comparator function to use, but we aren't going to use it. only pass one parameter to collections.sort.print the list again using the printlist methodcall the collections.binarysearch method to search the list for the value 1.5.this method takes two parameters, the list you want to search and the value you want to search for (1.5 in this case).this method returns an integer value. this is the index of the item that was found.print the index where 1.5 was found.call the collections.fill method to zero out the list.this method takes two parameters, the list you want to change and the value you want to fill it with (0.0 in this case).print the list again using the printlist method