Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,151 questions

40,705 answers

573 users

How to measure time in milliseconds using Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
            long startTime = System.currentTimeMillis();
            for (int i = 0; i < 2000000; i++);
	        long estimatedTime = System.currentTimeMillis() - startTime;
	        System.out.println(estimatedTime);
    }
}

/*
run:
  
3
 
*/

 





answered May 31, 2018 by avibootz

Related questions

1 answer 89 views
1 answer 75 views
2 answers 26 views
2 answers 24 views
24 views asked Oct 14, 2023 by avibootz
3 answers 46 views
46 views asked Mar 13, 2023 by avibootz
...