Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. Dates and Times > Measuring Elapsed Time

Recipe 6.12. Measuring Elapsed Time

6.13.1. Problem

You need to time how long it takes to do something.

6.13.2. Solution

Call System.currentTimeMillis( ) twice, or System.nanoTime( ) , and subtract the first result from the second result.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint