Here you can find the source of stringToTime(String schedule)
public static Time stringToTime(String schedule)
//package com.java2s; //License from project: Apache License import java.sql.Time; public class Main { private static final String SEPARATOR = ":"; public static Time stringToTime(String schedule) { if (schedule == null || schedule.isEmpty()) return null; String[] parts = schedule.split(SEPARATOR); if (parts.length != 3) return null; int hour = Integer.parseInt(parts[0]); int minute = Integer.parseInt(parts[1]); int second = Integer.parseInt(parts[2]); if (hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59) return null; return new Time(hour, minute, second); }/* w ww .j av a2 s .c o m*/ }