Here you can find the source of nextSecond(int second)
public static Date nextSecond(int second)
//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 nextSecond(int second) { Calendar now = now();// w w w . j ava 2 s . co m now.set(Calendar.SECOND, now.get(Calendar.SECOND) + second); return now.getTime(); } public static Calendar now() { Calendar now = new GregorianCalendar(); now.setTimeInMillis(new Date().getTime()); now.setTimeZone(TimeZone.getDefault()); return now; } }