Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jjj;
- public class jjj {
- public static void main( String[] args ) {
- int[] arr = new int[10000000];
- for (int i = 0; i < 10000000; i++) {
- arr[i] = i;
- }
- long t0 = System.currentTimeMillis();
- long sum = 0;
- for (int i = 0; i < 10000000; i++) {
- sum += arr[i];
- }
- long t1 = System.currentTimeMillis();
- System.out.println("The call took "+(t1 - t0)+"ms to run. Sum is "+sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement