测试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);
	}
}


/**************************************************************************
                  原文来自博客园——Submarinex的博客: www.cnblogs.com/submarinex/               
  *************************************************************************/

原文地址:https://www.cnblogs.com/submarinex/p/2032250.html