Here you can find the source of nextHour(int hour)
public static Date nextHour(int hour)
//package com.java2s; //License from project: Artistic License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { public static Date nextHour(int hour) { Calendar now = now();/*w ww. j a va 2 s. co m*/ now.set(Calendar.HOUR_OF_DAY, now.get(Calendar.HOUR_OF_DAY) + hour); return now.getTime(); } public static Calendar now() { Calendar now = new GregorianCalendar(); now.setTimeInMillis(new Date().getTime()); now.setTimeZone(TimeZone.getDefault()); return now; } }