@@ -0,0 +1,1946 @@
+package week10;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0Aimport java.util.Random;%0A%0Apublic class MicroBenchmarkLists %7B%0A%09%0A%09public static final Random random = new Random();%0A%0A%0A%09public static void main(String%5B%5D args) %7B%0A%0A%09%09List%3CInteger%3E numsArrayList = new ArrayList%3C%3E();%0A%09%09List%3CInteger%3E numsLinkedList = new LinkedList%3C%3E();%0A%09%09%0A%09%09final int listSize = 1000000;%0A%09%09final int timesToAccess = 5000;%0A%09%09%0A%09%09long startArrayList = System.currentTimeMillis();%0A%09%09for(int i = 0; i %3C listSize; i++) %7B%0A%09%09%09numsArrayList.add(getRandomInt());%0A%09%09%7D%0A%09%09long endArrayList = System.currentTimeMillis();%0A%09%09%0A%09%09System.out.println(%22The array list took this long to populate: %22);%0A%09%09System.out.println((endArrayList - startArrayList) + %22 ms%5Cn%22);%0A%09%09%0A%09%09System.out.println(%22Array List random access * %22 + timesToAccess);%0A%09%09%0A%09%09long startALAccess = System.currentTimeMillis();%0A%09%09for(int i = 0; i %3C timesToAccess; i++) %7B%0A%09%09%09numsArrayList.get(random.nextInt(listSize - 1));%0A%09%09%7D%0A%09%09long endALAccess = System.currentTimeMillis();%0A%09%09%0A%09%09System.out.println(%22It took %22 + (endALAccess - startALAccess) + %22 ms%5Cn%22);%0A%09%09%0A%09%09%0A%09%09////////////////////////////////%0A%09%09%0A%09%09long startLinkedList = System.currentTimeMillis();%0A%09%09for(int i = 0; i %3C listSize; i++) %7B%0A%09%09%09numsLinkedList.add(getRandomInt());%0A%09%09%7D%0A%09%09long endLinkedList = System.currentTimeMillis();%0A%09%09%0A%09%09System.out.println(%22The linked list took this long to populate: %22);%0A%09%09System.out.println((endLinkedList - startLinkedList) + %22 ms%5Cn%22);%0A%09%09%0A%09%09System.out.println(%22Linked List random access * %22 + timesToAccess);%0A%0A%09%09long startLLAccess = System.currentTimeMillis();%0A%09%09for(int i = 0; i %3C timesToAccess; i++) %7B%0A%09%09%09numsLinkedList.get(random.nextInt(listSize - 1));%0A%09%09%7D%0A%09%09long endLLAccess = System.currentTimeMillis();%0A%09%09%0A%09%09System.out.println(%22It took %22 + (endLLAccess - startLLAccess) + %22 ms%5Cn%22);%0A%09%09%0A%09%7D%0A%09%0A%09public static int getRandomInt() %7B%0A%09%09return (int)Math.floor((random.nextInt() * 1000*1000) + 1000*1000);%0A%09%7D%0A%0A%7D%0A

Create MicroBenchmarkLists.java