Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

timecount1

By: ace on Sep 22nd, 2010  |  syntax: None  |  size: 1.01 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. /**
  3.  * Write a description of class MathLoop here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class MathLoop
  9. {
  10.     // instance variables - replace the example below with your own
  11.     private int x;
  12.     private int y;
  13.     private long time1;
  14.     private long time2;
  15.     /**
  16.      * Constructor for objects of class MathLoop
  17.      */
  18.     public MathLoop()
  19.     {
  20.         // initialise instance variables
  21.         x = 1;
  22.         y = x-1;
  23.         time1 = 0;
  24.     }
  25.  
  26.     /**
  27.      * An example of a method - replace this comment with your own
  28.      *
  29.      * @param  y   a sample parameter for a method
  30.      * @return     the sum of x and y
  31.      */
  32.     public long count()
  33.     {
  34.         time1 = System.currentTimeMillis();
  35.        
  36.        while(x < 100)
  37.         {
  38.             x = x+1;
  39.            System.out.println("" + x);
  40.         }
  41.         time2 = System.currentTimeMillis();
  42.         time2 = time2 - time1;
  43.         return time2;
  44.         }
  45.        
  46.        
  47.    
  48. }