Warning: Invalid argument supplied for foreach() in /home/e1rsbco/public_html/hafriz/wp-content/plugins/facebook-import-comments/classes/FacebookCommentImporter.php on line 185
Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X
Post

Java Running / Execution Time

public class ExecutionTimer {
  private long start;
  private long end;

  public ExecutionTimer() {
    reset();
  }

  public void start() {
    start = System.currentTimeMillis();
  }

  public void end() {
    end = System.currentTimeMillis();
  }

  public long duration(){
    return (end-start);
  }

  public void reset() {
    start = 0;
    end   = 0;
  }

  public static void main(String s[]) {
    // simple example
    ExecutionTimer t = new ExecutionTimer();
    t.start();
    //antara ini
     for (int i=0; i < 80; i++){ System.out.print(".");}
    // dan ini letak lah coding yang kite nak check execution time dia brape.
    t.end();
    System.out.println("\n" + t.duration() + " ms");
  }
}

Related posts:

  1. N-Queen
  2. JSP tutorial
  3. MySQL + Tomcat JSP Test Script
  4. sending mail using jsp
  5. string kepada format date

Leave a comment  

name*

email*

website

Submit comment