Java TimeUnit.toMicros(long duration)

Syntax

TimeUnit.toMicros(long duration) has the following syntax.

public long toMicros(long duration)

Example

In the following code shows how to use TimeUnit.toMicros(long duration) method.


import java.util.concurrent.TimeUnit;
/*w  w  w .  j av  a  2 s  .c om*/
public class Main {
  public static void main(String[] args) {
    TimeUnit tu = TimeUnit.DAYS;

    System.out.println(tu.toDays(1));
    System.out.println(tu.toHours(1));
    System.out.println(tu.toMicros(1));

  }
}




















Home »
  Java Tutorial »
    java.util.concurrent »




ArrayBlockingQueue
BlockingDeque
CountDownLatch
CyclicBarrier
TimeUnit