
timecount1
By:
ace on
Sep 22nd, 2010 | syntax:
None | size: 1.01 KB | hits: 14 | expires: Never
/**
* Write a description of class MathLoop here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MathLoop
{
// instance variables - replace the example below with your own
private int x;
private int y;
private long time1;
private long time2;
/**
* Constructor for objects of class MathLoop
*/
public MathLoop()
{
// initialise instance variables
x = 1;
y = x-1;
time1 = 0;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public long count()
{
time1 = System.currentTimeMillis();
while(x < 100)
{
x = x+1;
System.out.println("" + x);
}
time2 = System.currentTimeMillis();
time2 = time2 - time1;
return time2;
}
}