{"id":122,"date":"2025-04-06T22:39:43","date_gmt":"2025-04-06T13:39:43","guid":{"rendered":"https:\/\/suyasuyahirohiro.com\/?p=122"},"modified":"2025-04-06T22:39:44","modified_gmt":"2025-04-06T13:39:44","slug":"%e3%83%9d%e3%83%a2%e3%83%89%e3%83%bc%e3%83%ad%e3%82%bf%e3%82%a4%e3%83%9e%e3%83%bc%e3%81%ae%e4%bd%9c%e6%88%90","status":"publish","type":"post","link":"https:\/\/suyasuyahirohiro.com\/?p=122","title":{"rendered":"\u30dd\u30e2\u30c9\u30fc\u30ed\u30bf\u30a4\u30de\u30fc\u306e\u4f5c\u6210"},"content":{"rendered":"\n<p>\u521d\u3081\u304b\u3089\u52d5\u304f\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u6210\u3059\u308b\u306e\u306f\u96e3\u3057\u3044\u3068\u8003\u3048\u307e\u3057\u305f\u3002<br>\u305d\u306e\u305f\u3081\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5206\u5272\u3057\u3066\u4f5c\u696d\u3092\u884c\u306a\u3063\u305f<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30f3\u30d7\u30eb\u306a\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u308b<\/li>\n\n\n\n<li>1\u79d2\u3054\u3068\u306b\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u3092\u8868\u793a\u3059\u308b<\/li>\n\n\n\n<li>\u96c6\u4e2d\u6642\u9593\u3068\u4f11\u61a9\u6642\u9593\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u30dd\u30e2\u30c9\u30fc\u30ed\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u308b<\/li>\n\n\n\n<li>\u30bf\u30a4\u30de\u30fc\u306e\u8868\u793a\u3092\u300c\u5206:\u79d2\u300d\u5f62\u5f0f\u306b\u3059\u308b<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b9\u30c6\u30c3\u30d71\uff1a\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30f3\u30d7\u30eb\u306a\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u308b<\/h3>\n\n\n\n<p>\u307e\u305a\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067\u6307\u5b9a\u3057\u305f\u79d2\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u3059\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n\n    private Timer timer; \/\/ \u30bf\u30a4\u30de\u30fc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n\n    \/\/ \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\n    public CountdownTimer(int seconds) {\n        timer = new Timer();\n        final int milliseconds = seconds * 1000; \/\/ \u30df\u30ea\u79d2\u5358\u4f4d\u306b\u5909\u63db\n\n        \/\/ \u30bf\u30a4\u30de\u30fc\u3092\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\n        timer.schedule(new CountdownTask(), milliseconds);\n    }\n\n    \/\/ \u30bf\u30a4\u30de\u30fc\u306e\u30bf\u30b9\u30af\n    class CountdownTask extends TimerTask {\n        @Override\n        public void run() {\n            System.out.println(\"\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u7d42\u4e86\uff01\"); \/\/ \u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u7d42\u4e86\u30e1\u30c3\u30bb\u30fc\u30b8\n            timer.cancel(); \/\/ \u30bf\u30a4\u30de\u30fc\u3092\u505c\u6b62\n        }\n    }\n\n    public static void main(String&#91;] args) {\n        Scanner scanner = new Scanner(System.in);\n\n        System.out.println(\"\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u3059\u308b\u79d2\u6570\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044:\");\n        int countdownSeconds = scanner.nextInt(); \/\/ \u30e6\u30fc\u30b6\u30fc\u304b\u3089\u79d2\u6570\u3092\u5165\u529b\n\n        new CountdownTimer(countdownSeconds);\n        System.out.println(countdownSeconds + \"\u79d2\u9593\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u3092\u3057\u307e\u3059\u3002\"); \/\/ \u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u958b\u59cb\u30e1\u30c3\u30bb\u30fc\u30b8\n\n        scanner.close(); \/\/ Scanner\u3092\u9589\u3058\u308b\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>Timer<\/code>\u30af\u30e9\u30b9\u3068<code>TimerTask<\/code>\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066\u3001\u6307\u5b9a\u3055\u308c\u305f\u79d2\u6570\u5f8c\u306b\u300c\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u7d42\u4e86\uff01\u300d\u3068\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"332\" height=\"109\" src=\"https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-04-04-15.33.26.png\" alt=\"\" class=\"wp-image-123\" srcset=\"https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-04-04-15.33.26.png 332w, https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-04-04-15.33.26-300x98.png 300w\" sizes=\"(max-width: 332px) 100vw, 332px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b9\u30c6\u30c3\u30d72\uff1a1\u79d2\u3054\u3068\u306b\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u3092\u8868\u793a\u3059\u308b<\/h3>\n\n\n\n<p>\u6b21\u306b\u30011\u79d2\u3054\u3068\u306b\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u306e\u6b8b\u308a\u6642\u9593\u3092\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n    \/\/ \u30bf\u30a4\u30de\u30fc\u306e\u30bf\u30b9\u30af\n    public void startCountDown() {\n        timer.scheduleAtFixedRate(new TimerTask() {\n        @Override\n        public void run() {\n            if (remainigSeconds > 0) {\n                System.out.println(remainigSeconds + \"\u79d2\");\n                remainigSeconds--;\n            }else{\n                System.out.println(\"\u7d42\u4e86\");\n                timer.cancel();\n            }\n\n        }\n        }, 0, 1000);\n    }\n<\/code><\/pre>\n\n\n\n<p><code>scheduleAtFixedRate<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u6307\u5b9a\u3057\u305f\u9593\u9694\uff08\u3053\u3053\u3067\u306f1\u79d2\uff09\u3067<code>run<\/code>\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"293\" height=\"296\" src=\"https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-04-05-21.24.58.png\" alt=\"\" class=\"wp-image-124\" srcset=\"https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-04-05-21.24.58.png 293w, https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-04-05-21.24.58-100x100.png 100w\" sizes=\"(max-width: 293px) 100vw, 293px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b9\u30c6\u30c3\u30d73\uff1a\u96c6\u4e2d\u6642\u9593\u3068\u4f11\u61a9\u6642\u9593\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u30dd\u30e2\u30c9\u30fc\u30ed\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u308b<\/h3>\n\n\n\n<p>\u3055\u3089\u306b\u3001\u96c6\u4e2d\u6642\u9593\u3068\u4f11\u61a9\u6642\u9593\u3092\u4ea4\u4e92\u306b\u7e70\u308a\u8fd4\u3059\u30dd\u30e2\u30c9\u30fc\u30ed\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class PomodoroTimer {\n    private int workSeconds;\n    private int breakSeconds;\n    private boolean isWorkTime = true;\n\n    public PomodoroTimer(int workSeconds, int breakSeconds) {\n        this.workSeconds = workSeconds;\n        this.breakSeconds = breakSeconds;\n    }\n\n    private void startTimer(int seconds, String message) {\n        CountdownTimer timer = new CountdownTimer(seconds);\n        timer.startCountdown(() -> {\n            if (isWorkTime) {\n                isWorkTime = false;\n                startTimer(breakSeconds, \"\u4f11\u61a9\");\n            } else {\n                System.out.println(\"\u30dd\u30e2\u30c9\u30fc\u30ed\u30bf\u30a4\u30de\u30fc\u7d42\u4e86\");\n            }\n        });\n        System.out.println(message + \"\u958b\u59cb\");\n    }\n}<\/code><\/pre>\n\n\n\n<p><code>isWorkTime<\/code>\u5909\u6570\u3092\u4f7f\u3063\u3066\u3001\u96c6\u4e2d\u30e2\u30fc\u30c9\u3068\u4f11\u61a9\u30e2\u30fc\u30c9\u3092\u5207\u308a\u66ff\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u753b\u9762\u53ce\u9332-2025-04-06-21.45.03.mov\"><\/video><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b9\u30c6\u30c3\u30d74\uff1a\u30bf\u30a4\u30de\u30fc\u306e\u8868\u793a\u3092\u300c\u5206:\u79d2\u300d\u5f62\u5f0f\u306b\u3059\u308b<\/h3>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001\u30bf\u30a4\u30de\u30fc\u306e\u8868\u793a\u3092\u300c\u5206:\u79d2\u300d\u5f62\u5f0f\u306b\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u5206\u3068\u79d2\u306b\u5909\u63db\nint minutes = remainingSeconds \/ 60;\nint seconds = remainingSeconds % 60;\n\n\/\/ 00:00\u5f62\u5f0f\u3067\u8868\u793a\nSystem.out.printf(\"%02d:%02d%n\", minutes, seconds);\n\n\/\/\u5165\u529b\u306e\u6307\u5b9a\nSystem.out.println(\"\u4f11\u61a9\u6642\u9593\u3092 00:00 \u5f62\u5f0f\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044:\");\nString breakTime = scanner.next();\nString&#91;] breakTimeParts = breakTime.split(\":\");\nint breakMinutes = Integer.parseInt(breakTimeParts&#91;0]);\nint breakSeconds = Integer.parseInt(breakTimeParts&#91;1]);\nint breakTotalSeconds = breakMinutes * 60 + breakSeconds;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/suyasuyahirohiro.com\/wp-content\/uploads\/2025\/04\/\u753b\u9762\u53ce\u9332-2025-04-06-22.26.14.mov\"><\/video><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p>\u4e0a\u8a18\u306e\u624b\u9806\u3092\u884c\u3044\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067\u30dd\u30e2\u30c9\u30fc\u30ed\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u6210\u3067\u304d\u307e\u3057\u305f\u3002<br>\u6b21\u56de\u306f\u30ed\u30fc\u30ab\u30eb\u30db\u30b9\u30c8\u4e0a\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u4f5c\u696d\u3057\u3066\u3044\u304d\u307e\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u3081\u304b\u3089\u52d5\u304f\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u6210\u3059\u308b\u306e\u306f\u96e3\u3057\u3044\u3068\u8003\u3048\u307e\u3057\u305f\u3002\u305d\u306e\u305f\u3081\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5206\u5272\u3057\u3066\u4f5c\u696d\u3092\u884c\u306a\u3063\u305f \u30b9\u30c6\u30c3\u30d71\uff1a\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30f3\u30d7\u30eb\u306a\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u30bf\u30a4\u30de\u30fc\u3092\u4f5c\u308b \u307e\u305a\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067\u6307\u5b9a\u3057\u305f\u79d2\u6570\u3092\u30ab &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=122"}],"version-history":[{"count":1,"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":127,"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions\/127"}],"wp:attachment":[{"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/suyasuyahirohiro.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}