Here you can find the source of isValidTimeUnit(String timeUnit)
public static boolean isValidTimeUnit(String timeUnit)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.TimeUnit; public class Main { public static boolean isValidTimeUnit(String timeUnit) { for (TimeUnit type : TimeUnit.values()) { if (type.name().equalsIgnoreCase(timeUnit)) { return true; }// w ww. j a v a2s. c om } return false; } }