fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. long now = System.currentTimeMillis();
  9. long count = 0;
  10. long total1 = 0;
  11. do {
  12. for (int i = 0 ; i != 1000 ; i++)
  13. total1 += 11;
  14. count++;
  15. } while (System.currentTimeMillis()-now < 2000);
  16. System.out.println("Primitives: "+count+" x1000 additions completed.");
  17. now = System.currentTimeMillis();
  18. count = 0;
  19. Long total2 = 0L;
  20. do {
  21. for (int i = 0 ; i != 1000 ; i++)
  22. total2 += 11;
  23. count++;
  24. } while (System.currentTimeMillis()-now < 2000);
  25. System.out.println("Wrapper: "+count+" x1000 additions completed.");
  26. }
  27. }
Success #stdin #stdout 4.05s 380224KB
stdin
Standard input is empty
stdout
Primitives: 1125085 x1000 additions completed.
Wrapper:    112760 x1000 additions completed.