java 时间单位.SECONDS.toMillis
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16308783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 22:35:59 来源:igfitidea点击:
TimeUnit.SECONDS.toMillis
提问by user1477955
I did not understand the explanation at oracle, what is this piece of code actually doing?
没看懂oracle的解释,这段代码到底是干什么的?
final int maximumDelay = (int) TimeUnit.SECONDS.toMillis(1000);
回答by Barend
It converts 1000 seconds into milliseconds, then truncates the result from long
to int
.
它将 1000 秒转换为毫秒,然后将结果从 截断long
到int
。