Skip to content

Instantly share code, notes, and snippets.

@calebrob6
Created October 24, 2013 23:44
Show Gist options
  • Save calebrob6/7147086 to your computer and use it in GitHub Desktop.
Save calebrob6/7147086 to your computer and use it in GitHub Desktop.
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