Here you can find the source of isTime(String timeStr)
public static boolean isTime(String timeStr)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean isTime(String timeStr) { SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss"); Date date = null;/*from w w w. j av a2 s.co m*/ try { date = df.parse(timeStr); } catch (ParseException e) { return false; } return date != null; } }