(๑•͈ᴗ•͈)❀送花给你

java:测试计算机运行速度

    public static void main(String[] args) {
        long startTime=System.currentTimeMillis();
        long endTime=startTime+60000;
        long index=0;
        while(true)
        {
            double x=Math.sqrt(index);
            long now=System.currentTimeMillis();
            if(now>endTime)
            {
                break;
            }
            index++;
        }
        System.out.println(index+" loops in one minute.");
    }

 

2021.09.13

posted @ 2021-09-13 09:11  胸前小红花  阅读(125)  评论(0)    收藏  举报