public long stop(){
  if (!stopped) {
    stopped=true;
    long elapsed=System.nanoTime() - startNanos;
    record(elapsed);
    return elapsed;
  }
  throw new IllegalStateException("Already stopped");
}

public long stop ( ) { if ( ! stopped ) { stopped = true ; long elapsed = System . nanoTime ( ) - startNanos ; record ( elapsed ) ; return elapsed ; } throw new IllegalStateException ( "Already stopped" ) ; }
stop the timer and record the elapsed time .
