Here you can find the source of setTime(final Date date, final int hourOfDay, final int minute, final int second)
public static Date setTime(final Date date, final int hourOfDay, final int minute, final int second)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date setTime(final Date date, final int hourOfDay, final int minute, final int second) { final GregorianCalendar gc = new GregorianCalendar(); gc.setTime(date);/*from w w w. j a v a 2s .com*/ gc.set(Calendar.HOUR_OF_DAY, hourOfDay); gc.set(Calendar.MINUTE, minute); gc.set(Calendar.SECOND, second); return gc.getTime(); } }