Here you can find the source of isDuration(String value)
public static boolean isDuration(String value)
//package com.java2s; // Licensed under the MIT license. See LICENSE file in the project root for full license information. import java.time.Duration; public class Main { public static boolean isDuration(String value) { try {/* w w w . j av a 2 s . c o m*/ Duration.parse(value); return true; } catch (Exception e) { return false; } } }