Advertisement
Guest User

Untitled

a guest
Feb 9th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.30 KB | None | 0 0
  1. int[] arr = new int[10000000]
  2.  
  3. for (int i = 0; i < 10000000; i++) {
  4.   arr[i] = i
  5. }
  6.  
  7. def t0 = System.currentTimeMillis()
  8. long sum = 0
  9.  
  10. for (int i = 0; i < 10000000; i++) {
  11.   sum += arr[i]
  12. }
  13.  
  14. def t1 = System.currentTimeMillis()
  15.  
  16. printf("The call took %dms to run. Sum is %d\n", (t1 - t0), sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement