fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Inicio de teste...");
  13. long inicio = System.currentTimeMillis();
  14.  
  15. //Testando List
  16. List<Integer> teste = new ArrayList<>();
  17.  
  18. for (int i = 0; i < 20; i++) {
  19. teste.add(0,i);
  20. }
  21.  
  22. for (int i = 0; i < 50; i++) {
  23. teste.add(0,i);
  24. }
  25.  
  26. for (int i: teste) {
  27. System.out.println(teste.get(i));
  28. }
  29.  
  30. long fim = System.currentTimeMillis();
  31. System.out.println("Tempo gasto: "+(fim - inicio)+" ms");
  32. }
  33. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
Inicio de teste...
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Tempo gasto: 4 ms