Here you can find the source of adjustCalendar(Calendar calendar)
private static void adjustCalendar(Calendar calendar)
//package com.java2s; import java.util.Calendar; public class Main { public static final int MILLISECONDS_PER_HOUR = 60 * 60 * 1000; private static void adjustCalendar(Calendar calendar) { if (calendar.get(Calendar.HOUR_OF_DAY) != 0) { if (calendar.get(Calendar.HOUR_OF_DAY) == 1) calendar.setTimeInMillis(calendar.getTimeInMillis() - MILLISECONDS_PER_HOUR); if (calendar.get(Calendar.HOUR_OF_DAY) == 23) calendar.setTimeInMillis(calendar.getTimeInMillis() + MILLISECONDS_PER_HOUR); }/*from w w w.ja va2 s. c om*/ } }