Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
org.apache.commons.lang3.time.StopWatch Example
What is org.apache.commons.lang3.time.StopWatch class? How to use org.apache.commons.lang3.time.StopWatch class?
✍: FYIcenter.com
org.apache.commons.lang3.time.StopWatch class is a Java class
offered in commons-lang3.jar that
provides a convenient API for timings.
Here is a simple example of org.apache.commons.lang3.time.StopWatch class:
// Copyright (c) 2016 FYIcenter.com
import java.math.BigInteger;
import java.util.Random;
import org.apache.commons.lang3.time.StopWatch;
// Example of using the StrSubstitutor class
public class StopWatchExample {
public static void main(String[] args) throws Exception {
// Create a StopWatch
StopWatch watch = new StopWatch();
// Start the StopWatch
watch.start();
// Do some work
for (int i=0; i<10; i++) {
BigInteger p = new BigInteger(2048, new Random());
BigInteger q = p.pow(2048);
System.out.println(i+": "+watch.getTime());
}
// Stop the StopWatch
watch.stop();
// Show the recorded time
System.out.println("Done in: "+watch.toString());
}
}
You can compile and run the above example in a command window as shown below:
C:\fyicenter>\local\jdk-1.8.0\bin\javac -cp C:\local\commons-lang3-3.5\commons-lang3-3.5.jar StopWatchExample.java C:\fyicenter>\local\jdk-1.8.0\bin\java -cp .;C:\local\commons-lang3-3.5\commons-lang3-3.5.jar StopWatchExample 0: 1119 1: 2225 2: 3333 3: 4461 4: 5564 5: 6671 6: 7776 7: 8882 8: 9988 9: 11095 Done in: 00:00:11.095
⇒ org.apache.commons.lang3.math.Fraction Example
⇐ org.apache.commons.lang3.text.StrSubstitutor Example
2016-11-24, ∼3035🔥, 0💬
Popular Posts:
commons-io-2.6-sources.j aris the source JAR file for Apache Commons IO 2.6, which is a library of u...
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google. ...
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...