Last active
July 5, 2018 12:00
-
-
Save kkabetani/0c23973ef95e867173a75c333d39d2b6 to your computer and use it in GitHub Desktop.
Duration 実験
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration; | |
class Hoge { | |
public static void main(String[] args) { | |
Duration d1 = Duration.ofSeconds(1); | |
System.out.println(d1.toMinutes()); | |
Duration d2 = Duration.ofSeconds(2); | |
System.out.println(d2.toMinutes()); | |
Duration d3 = Duration.ofSeconds(59); | |
System.out.println(d3.toMinutes()); | |
Duration d4 = Duration.ofSeconds(60); | |
System.out.println(d4.toMinutes()); | |
Duration d5 = Duration.ofSeconds(119); | |
System.out.println(d5.toMinutes()); | |
Duration d6 = Duration.ofSeconds(120); | |
System.out.println(d6.toMinutes()); | |
Duration d7 = Duration.ofSeconds(150); | |
System.out.println(d7.toMinutes()); | |
} | |
} | |
/* | |
>java Hoge | |
0 | |
0 | |
0 | |
1 | |
1 | |
2 | |
2 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment