There is always the old-fashioned way:
long startTime = System.nanoTime(); methodToTime(); long endTime = System.nanoTime(); long duration = (endTime - startTime); //divide by 1000000 to get milliseconds.
Related Posts:
- What is an instance variable in Java?
- super() in Java
- What’s the syntax for mod in java
- What does the Java assert keyword do, and when should it be used?
- How do I make a delay in Java?
- Casting variables in Java
- max value of integer
- How can I prevent java.lang.NumberFormatException: For input string: “N/A”?
- What is the difference between == and equals() in Java?
- What does “?” mean in Java?
- Java – No enclosing instance of type Foo is accessible
- Why I am getting java.lang.AbstractMethodError errors?
- fix java.net.SocketTimeoutException: Read timed out
- How to override equals method in Java
- java.text.ParseException: Unparseable date
- Java – String cannot be converted to int
- java.io.IOException: Broken pipe
- java.util.NoSuchElementException: No line found
- Even though JRE 8 is installed on my MAC -” No Java Runtime present,requesting to install ” gets displayed in terminal
- Reason for the exception java.lang.VerifyError: Bad type on operand stack
- The specified DSN contains an architecture mismatch between the Driver and Application. JAVA
- Downcasting in Java
- Java “params” in method signature?
- repaint() Method in Java
- Exception in thread “main” java.lang.reflect.InvocationTargetException
- How to set String’s font size, style in Java using the Font class?
- How to use the command update-alternatives –config java
- java array error “array required but int found”
- this: Cannot use this in static context
- What’s the difference between SoftReference and WeakReference in Java?
- How to draw lines in Java
- NoClassDefFoundError in Java: com/google/common/base/Function
- In Java, what is a shallow copy?
- Good way to encapsulate Integer.parseInt()
- Eclipse IDE – Error: Build path specifies execution environment Java SE 1.7
- Java: Not a statement
- ArrayList of int array in java
- How to get the filename without the extension in Java?
- How can I upgrade to Java 1.8 on an Amazon Linux Server?
- Problem with gif with transparent background
- api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft Office file [closed]
- Search for words with telephone numbers from 2-3-4 tree
- Istio Ingress resulting in “no healthy upstream”
- Creating a “logical exclusive or” operator in Java
- What are the rules of the std::cin object in C++?
- Cannot make a static reference to the non-static method fxn(int) from the type Two [duplicate]
- Where do I find a list of all mat-icons — Angular
- When is the @JsonProperty property used and what is it used for?
- TypeError : ‘method’ object is not subscriptable
- In C++, what is wx.h?
- What is the /= operator in Java?
- How to clamp an integer to some range?
- What is the iOS 8 System Font?
- Java SimpleDateFormat for YYYY-MM-DDThh:mm:ssTZD
- Best Java obfuscator?
- Simple prime number generator in Python
- round up to 2 decimal places in java?
- com.sun.jdi.InvocationException occurred invoking method
- How can I check whether an array is null / empty?
- How to solve javax.net.ssl.SSLHandshakeException Error?
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘demoRestController’
- What causes java.lang.IncompatibleClassChangeError?
- Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- This Activity already has an action bar supplied by the window decor?
- Convert hex string to int
- Orphaned Case Error in Java
- Proxy Error 502 : The proxy server received an invalid response from an upstream server
- Java double.MAX_VALUE?
- Too small initial heap error – stanford parser
- Incompatible types List of List and ArrayList of ArrayList
- How can I run a Java program in Atom editor?
- Dice Rolling java program
- All com.android.support libraries must use the exact same version specification
- int cannot be converted to int []
- Joda DateTime to Timestamp conversion
- break statement in “if else” – java
- Java equivalent of unsigned long long?
- Getting “unixtime” in Java
- How do you detect where two line segments intersect?
- How do I break out of nested loops in Java?
- How do I convert this for loop into a while loop?
- Java switch statement: Constant expression required, but it IS constant
- What is an attribute in Java?
- how to upload a file to my server using html
- KeyPressed event in java
- MessageBodyWriter not found for media type=application/json
- Conversion from Long to Double in Java
- Failed to find Java VM
- Any benefit or detriment from removing a pagefile on an 8 GB RAM machine?
- How do I view the details of a digital certificate .cer file?
- How do you validate fstab without rebooting?
- DNS – NSLOOKUP what is the meaning of the non-authoritative answer?
- Why can’t a CNAME record be used at the apex (aka root) of a domain?
- What port should I open to allow remote desktop?
- Can you help me with my capacity planning?
- Cheat Sheets for System Administrators?
- Amazon EC2 terminology – AMI vs. EBS vs. Snapshot vs. Volume
- How to change an EC2 instance’s security group
- What type of DNS record is needed to make a subdomain?
- Multiple SSL domains on the same IP address and same port?