Source of 4.ForProjects.java


  1: Date current = new Date();               // Get current time
  2: long startTime = current.getTime();
  3: thisMethod();                            // Code to be timed
  4: current = new Date();                    // Get current time
  5: long stopTime = current.getTime();
  6: long elapsedTime = stopTime - startTime; // Milliseconds