### Question:
DateUtils { public static long diffHours(Date d1, Date d2) { return (long) Math.ceil(diffMin(d1, d2) / 60.0); } private  DateUtils(); static String getCurrentTime(); static String getCurrentTime(String format); static String format(Date date, String format); static String format(LocalDateTime localDateTime, String format); static String dateToString(Date date); static Date parse(String date, String format); static Date stringToDate(String str); static long differSec(Date d1, Date d2); static long differMs(Date d1, Date d2); static long diffHours(Date d1, Date d2); static long diffMin(Date d1, Date d2); static Date getSomeDay(Date date, int day); static int getHourIndex(Date date); static boolean compare(Date future, Date old); static Date getScheduleDate(String schedule); static String format2Readable(long ms); static Date getMonday(Date date); static Date getSunday(Date date); static Date getFirstDayOfMonth(Date date); static Date getSomeHourOfDay(Date date, int offsetHour); static Date getLastDayOfMonth(Date date); static Date getStartOfDay(Date inputDay); static Date getEndOfDay(Date inputDay); static Date getStartOfHour(Date inputDay); static Date getEndOfHour(Date inputDay); static Date getCurrentDate(); static Date add(final Date date, final int calendarField, final int amount); static long getRemainTime(Date baseTime, long intervalSeconds); static String getCurrentTimeStamp();  }### Answer:
@Test public void diffHours() { Date d1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Date d2 = DateUtils.stringToDate("2019-01-28 20:00:00"); Assert.assertEquals(DateUtils.diffHours(d1, d2), 20); Date d3 = DateUtils.stringToDate("2019-01-28 20:00:00"); Assert.assertEquals(DateUtils.diffHours(d3, d2), 0); Assert.assertEquals(DateUtils.diffHours(d2, d1), 20); Date d4 = null; Assert.assertEquals(DateUtils.diffHours(d2, d4), 0); }