Created
October 24, 2013 23:44
-
-
Save calebrob6/7147086 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class GrowArray { | |
public static void main(String[] args) { | |
ArrayList<Integer> test = new ArrayList<Integer>(); | |
long maxTime = 0; | |
for(int i=0;i<100000000;i++){ | |
long start = System.currentTimeMillis(); | |
test.add(i); | |
long end = System.currentTimeMillis(); | |
if(end-start>maxTime){ | |
maxTime = end-start; | |
System.out.println(i+ " " + maxTime); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment