Code example for Stopwatch

0
    public KnownElapsedTimeTicker(long expectedElapsedTime) {
        this.expectedElapsedTime = expectedElapsedTime;
    } 
 
    static Stopwatch aStopWatchWithElapsedTime(long elapsedTime) {
        return new Stopwatch(new KnownElapsedTimeTicker(elapsedTime)).start().stop();
    } 
 
    @Override 
    public long read() { 
        firstRead = !firstRead;
        return firstRead ? 0 : expectedElapsedTime;
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE