当前位置:网站首页>long start = currentTimeMillis();
long start = currentTimeMillis();
2022-06-22 05:11:00 【a good idea】
package currentTimeMillis;
import java.util.Random;
import static java.lang.System.currentTimeMillis;
import static java.lang.Thread.sleep;
public class TaskMethodProvider {
private static Random random = new Random();
public void taskOne() throws Exception {
System.out.println("开始做任务一");
long start = currentTimeMillis();
sleep(random.nextInt(10000));
long end = currentTimeMillis();
System.out.println("完成任务一,耗时:" + (end - start) + "毫秒");
}
public void taskTwo() throws Exception {
System.out.println("开始做任务二");
long start = currentTimeMillis();
sleep(random.nextInt(10000));
long end = currentTimeMillis();
System.out.println("完成任务二,耗时:" + (end - start) + "毫秒");
}
public void taskThree() throws Exception {
System.out.println("开始做任务三");
long start = currentTimeMillis();
sleep(random.nextInt(10000));
long end = currentTimeMillis();
System.out.println("完成任务三,耗时:" + (end - start) + "毫秒");
}
}
边栏推荐
猜你喜欢

Hanoi Tower problem

10道不得不会的 Redis 面试题

Leetcode -- the kth largest node of the binary search tree (traversal by means of middle order)

When idea creates a method, it uses annotations to prompt method parameters (param), return value (return), and method function (description)

下拉刷新,上推加载(简单好用,终于会了)
![[details] domestic website filing process and steps](/img/be/be74c1e586ff01403fcafff19a462a.jpg)
[details] domestic website filing process and steps

这是一个图片

获取DPI函数返回值永远是96 | 获取DPI函数返回值不正确 | GetDpiForMonitor/GetDeviceCaps返回值不正确的原因

10 "no no no" redis interview questions

Progress information collection for progress control of Zhiyuan project management SPM system
随机推荐
Start with the strategy of small market value factor, and take you into quantitative investment (with the strategy of 77.83% annualized return)
Tupu software 2D and 2.5D case collection | smart Park, data center, SMT production line
10 "no no no" redis interview questions
In depth understanding of JS delete
Remote dictionary server (redis) - a kV based NoSQL database management system used as a cache
Go learning (II. Built in container)
DeformConv
Progress warning and problem management of progress control in Zhiyuan project management SPM system
并发编程——线程池
9 practical shell scripts, recommended collection!
IQueryable和IEnumerable的区别
Idea创建方法时,使用注解提示方法参数(param)、返回值(return)、方法作用(Description)
Monorepo Sliding methodology: Reference module Hot Update
JUC - thread interrupt and thread waiting and wakeup (locksupport)
Storage mode and lifetime of C language variables
[scientific research notes] focal loss
Flink deployment mode (II) - three deployment modes of yarn
laravel的服务容器,服务提供者,门面的理解
flink部署模式(二)- yarn三种部署模式
[fault diagnosis] cv2 Imwrite cannot write the picture, but the program does not report an error