ArrayList <Integer> list = new ArrayList <Integer>();//optionally add an initial size as an argument
list.add(5);//appends to the end of the list
list.add(1, 6);//assigns the element at index 1
System.out.println(list.get(0));