Here you can find the source of toCalendar(long hour)
static public Calendar toCalendar(long hour)
//package com.java2s; //License from project: LGPL import java.util.Calendar; public class Main { static public Calendar toCalendar(long hour) { Calendar calNow = Calendar.getInstance(); Calendar calSet = (Calendar) calNow.clone(); calSet.set(Calendar.HOUR_OF_DAY, calNow.get(Calendar.HOUR_OF_DAY)); calSet.set(Calendar.MINUTE, calNow.get(Calendar.MINUTE)); calSet.set(Calendar.SECOND, calNow.get(Calendar.SECOND) + 3); calSet.set(Calendar.MILLISECOND, 0); return calSet; }/*from w ww .j a va 2 s . c o m*/ }