Here you can find the source of parseSessionTime(String response)
private static List<Date> parseSessionTime(String response)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class Main { private static List<Date> parseSessionTime(String response) { List<Date> res = new ArrayList<Date>(); int idx = response.indexOf("<div class=\"purple_box\">"); while (idx > 0) { int sDayIdx = response.indexOf(">", idx + 10) + 1; String day = response.substring(sDayIdx, response.indexOf("<", sDayIdx)); SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); Date utilDate = null; try { utilDate = format.parse(day); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace();// w w w. j av a2 s. c o m } idx = response.indexOf("/visLtyTicketsLogin.aspx", idx + 10); int endDayIdx = response.indexOf("</ul>", idx); while (idx > 0 && idx < endDayIdx) { int sTime = response.indexOf(">", idx) + 1; int eTime = response.indexOf("<", sTime); String time = response.substring(sTime, eTime).trim(); int hour = Integer.parseInt(time.substring(0, 2)); int mins = Integer.parseInt(time.substring(3, 5)); long addTime = 60 * 60 * 1000 * hour + 60 * 1000 * mins; Date sesTime = utilDate != null ? new Date( utilDate.getTime() + addTime) : null; res.add(sesTime); idx = response.indexOf("/visLtyTicketsLogin.aspx", eTime + 10); } idx = response.indexOf("<div class=\"purple_box\">", endDayIdx); } return res; } }