### Question:
DateUtils { public static boolean isSameHour(Date date1, Date date2) { Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DAY_OF_MONTH) == cal2.get(Calendar.DAY_OF_MONTH) && cal1.get(Calendar.HOUR_OF_DAY) == cal2.get(Calendar.HOUR_OF_DAY); } private  DateUtils(); static boolean isSameDay(Date date1, Date date2); static boolean isSameHour(Date date1, Date date2); static boolean isSameMinute(Date date1, Date date2);  }### Answer:
@Test public void testSameHour() { Assert.assertTrue(isSameHour(new Date(), new Date())); Assert.assertFalse(isSameHour(new Date(), new Date(System.currentTimeMillis() + 60 * 60 * 1000))); }