gpt4 book ai didi

java - 在我的 java 程序上添加运行时

转载 作者:行者123 更新时间:2023-11-29 08:16:38 25 4
gpt4 key购买 nike

我有我的 Java 程序,我想添加显示计算运行时间的代码,但我不知道该怎么做?

最佳答案

这样测量:

long startTime = System.currentTimeMillis();

.... // code block you want to measure.

System.out.println("Execution took: "+(System.currentTimeMillis() - startTime));

关于java - 在我的 java 程序上添加运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4340484/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com