测试java代码运行时间

public class Test 
{
	public static void main(String[] args)
	{
	//	long startTime = System.nanoTime();			 	// 纳秒级
		long startTime = System.currentTimeMillis();   	// 毫秒级

	//  测试的代码
		
	//	long estimatedTime = System.nanoTime() - startTime;
		long estimatedTime=System.currentTimeMillis() - startTime;
		System.out.println(estimatedTime);
	}
}

posted @ 2011-04-28 22:28  SubmarineX  阅读(1291)  评论(0编辑  收藏  举报