long t1=system.currentTimeMillis(); //运行测试内容 code long t2=system.currentTimeMillis(); System.out.println(t2-t1); 单位:毫秒