Hello! How can I measure time of executing of this program? Thanks!
package hanoi;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
final byte size = 35;
Tower t = new Tower(size);
t.MoveTower(size, 1, 3, 2);
System.out.println(t.getSteps());
System.out.println(Math.pow(2, size) - 1);
}
}
package hanoi;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
final byte size = 35;
Tower t = new Tower(size);
//detect the initial time
int start = (int)System.currentTimeMillis();
t.MoveTower(size, 1, 3, 2);
//detect execution time
int time = (int)(System.currentTimeMillis() - start);
System.out.println(t.getSteps());
System.out.println(Math.pow(2, size) - 1);
System.out.println("Execution time:" +time);
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF