Java.util.concurrent-------Timeunit

Source: Internet
Author: User

The java.util.concurrent concurrency Library is a new JDK1.5, the author of Doug Lea, who is a boss-level genius. With the class library He provides, we have a lot of help for multithreading concurrency and lock, which reduces the concurrency difficulty, And the synchronized synchronization with Java itself has a great performance boost. Readlock, Writelock makes the control less powerful and more accurate.
Timeunit is an enumeration type that can convert time quickly and easily to (days, hours, minutes, seconds, nanoseconds) Day,hour,minute,second,millli ...
With this class we can easily convert the time
For example:
1, we will convert 1 hours to how many minutes, how many seconds
1-hour conversion minutes to 60 Minutes
TimeUnit.HOURS.toMinutes (1) =>60
1-hour conversion minutes to 3,600 seconds
TimeUnit.HOURS.toMinutes (1) =>3600
2, if the second conversion to hours, minutes
3,600 seconds conversion minutes to 60 Minutes
TimeUnit.SECONDS.toMinutes (3600) =>60
3,600-second conversion hours to 1 hours

TimeUnit.SECONDS.toHours (3600) =>1

Java.util.concurrent-------Timeunit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.