代码
double doub = -54450.0;
Calendar calStart = Calendar.getInstance();
long start = calStart.getTimeInMillis();
System.out.println("开始时间:" + start);
for (int i = 1; i <= 1000000000; i++)
{
if (doub < 0) // 311毫秒
// if (doub < 0.0)// 共用时306毫秒
{
// System.out.println("小于0");
}
}
Calendar calEnd = Calendar.getInstance();
long end = calEnd.getTimeInMillis();
System.out.println("结束时间:" + end);
System.out.println("共用时" + (end - start) + "毫秒");
结果:两者时间差不多