How to use stopwatch in JAVA – Guava Stopwatch

How to use stopwatch in JAVA – guava stopwatch
Some times we want to check the how much time taken for a particular functionality, method or a statement. By using stopwatch it is to much easier to get the elapsed time.


Download Guava jar from –


Below example will show how much time it takes by BigDecimal – creating the object and setting the scale.
you can get the different time elapsed format like min, sec, mill, nano etc.


Now run below example –

Gopal Das
Follow me

Gopal Das

Founder at GopalDas.Org
He is a technology evangelist, Salesforce trainer, blogger, and working as a Salesforce Technical Lead. After working in Java based project implementation, he jumped to the Salesforce system on a whim and never looked back. He fell in love with Salesforce’s flexibility, scalability, and power. He expanded his knowledge of the platform and became a Certified App Builder, Administrator, Platform Developer I, SalesCloud Consultant while leading the Salesforce implementation and technology needs. He has worked in a wide variety of applications/services like desktop, web and mobile applications.
Gopal Das
Follow me

Leave a Reply

Your email address will not be published. Required fields are marked *