

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to get the current value of the system timer in nanoseconds
Use System.nanoTime() method in Java to get the current value of the system timer in nanoseconds. It d returns the current value of the most precise available system timer, in nanoseconds.
We are getting the system timer value in a long type −
long res = System.nanoTime();
The following is an example −
Example
public class Demo { public static void main(String[] args) { long res = System.nanoTime(); System.out.println("Current Value: " + res + " nanoseconds"); } }
Output
Current Value: 49908709882168 nanoseconds
- Related Questions & Answers
- Java program to Get IP address of the system
- Java Program to get date for all the days of the current week
- Terminate the timer in Java
- Java Program to convert this duration to the total length in nanoseconds
- How to get the current date in Java?
- Java Program to Get Current Working Directory
- Java Program to Get Current Date/Time
- Get the Current Working Directory in Java
- Get the String representation of the current File object in Java
- Cancel the Timer Task in Java
- Call the run() method of the Timer Task in Java
- Get the default system properties in Java
- C# Program to get the absolute value of the time
- Timer in C++ using system calls
- C# Program to set the timer to zero
Advertisements