Guest User

Untitled

a guest
Feb 9th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. package jjj;
  2.  
  3. public class jjj {
  4.   public static void main( String[] args ) {
  5.     ttt();
  6.     ttt();
  7.     ttt();
  8.   }
  9.  
  10.   static void ttt() {
  11.     int[] arr = new int[10000000];
  12.    
  13.     for (int i = 0; i < 10000000; i++) {
  14.       arr[i] = i;
  15.     }
  16.    
  17.     long t0 = System.currentTimeMillis();
  18.     long sum = 0;
  19.    
  20.     for (int i = 0; i < 10000000; i++) {
  21.       sum += arr[i];
  22.     }
  23.    
  24.     long t1 = System.currentTimeMillis();
  25.    
  26.     System.out.println("The call took "+(t1 - t0)+"ms to run. Sum is "+sum);
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment