Advertisement
tahg

Untitled

Feb 16th, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. int[] array1 = new int[1000000], array2 = new int[1000000];
  2. long start = System.nanoTime();
  3. for (int i = 1; i < 100000; i++) {
  4. System.arraycopy(array2, 0, array1, 0, 1000000);
  5. }
  6. System.out.println(System.nanoTime() - start);
  7. start = System.nanoTime();
  8. for (int i = 1; i < 100000; i++) {
  9. for (int j = 0; j < 1000000; j++)
  10. array1[j] = 0;
  11. }
  12. System.out.println(System.nanoTime() - start);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement