Example usage for java.lang System currentTimeMillis

List of usage examples for java.lang System currentTimeMillis

Introduction

In this page you can find the example usage for java.lang System currentTimeMillis.

Prototype

@HotSpotIntrinsicCandidate
public static native long currentTimeMillis();

Source Link

Document

Returns the current time in milliseconds.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    long start = System.currentTimeMillis();

    Thread.sleep(2000);/*from  w  ww .ja va  2s.c  om*/

    // Get elapsed time in milliseconds
    long elapsedTimeMillis = System.currentTimeMillis() - start;
    // Get elapsed time in minutes
    float elapsedTimeMin = elapsedTimeMillis / (60 * 1000F);
    System.out.println(elapsedTimeMin);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    long start = System.currentTimeMillis();

    Thread.sleep(2000);/*w  w w . ja  va2  s .  c  o  m*/

    // Get elapsed time in milliseconds
    long elapsedTimeMillis = System.currentTimeMillis() - start;

    // Get elapsed time in minutes
    float elapsedTimeMin = elapsedTimeMillis / (60 * 1000F);
    System.out.println(elapsedTimeMin);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    long start = System.currentTimeMillis();

    Thread.sleep(2000);//w  w w  .  ja va  2  s.c o m

    // Get elapsed time in milliseconds
    long elapsedTimeMillis = System.currentTimeMillis() - start;

    // Get elapsed time in hours
    float elapsedTimeHour = elapsedTimeMillis / (60 * 60 * 1000F);
    System.out.println(elapsedTimeHour);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    long startTime = System.currentTimeMillis();

    for (int i = 0; i < 10; i++) {
        Thread.sleep(60);/*  w w w .j  ava 2 s  . co  m*/
    }
    long endTime = System.currentTimeMillis();
    float seconds = (endTime - startTime) / 1000F;
    System.out.println(Float.toString(seconds) + " seconds.");
}

From source file:SystemApp.java

public static void main(String args[]) {
    long time = System.currentTimeMillis();
    System.out.println(time);/*from  w w w . jav  a 2 s .  c  o  m*/
    Properties p = System.getProperties();
    p.list(System.out);
    System.exit(13);
}

From source file:Main.java

public static void main(String[] args) throws Exception {

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);
    System.out.println(fileTime.hashCode());

}

From source file:Main.java

public static void main(String[] args) throws Exception {

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);
    System.out.println(fileTime.toMillis());

}

From source file:Main.java

public static void main(String[] args) throws Exception {

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);
    System.out.println(fileTime.toString());

}

From source file:Main.java

public static void main(String[] args) {

    System.out.print("Current Time in milliseconds = ");
    System.out.println(System.currentTimeMillis());
}

From source file:Main.java

public static void main(String[] args) {
    long first = System.currentTimeMillis();
    IntStream.range(0, 4).map(a -> {
        sleep1sec();//from  w  w w.  j  a  v a 2  s. com
        return a;
    }).reduce((a, b) -> a * b).ifPresent(System.out::println);

    long second = System.currentTimeMillis();
    System.out.println("time 1:" + (second - first));

    IntStream.range(0, 4).parallel().map(a -> {
        sleep1sec();
        return a;
    }).reduce((a, b) -> a * b).ifPresent(System.out::println);

    long last = System.currentTimeMillis();
    System.out.println("time 2:" + (last - second));

}