Here you can find the source of getCalendar(boolean dateAndTime)
public static Calendar getCalendar(boolean dateAndTime)
//package com.java2s; import java.util.*; public class Main { public static Calendar getCalendar(boolean dateAndTime) { Calendar cal = Calendar.getInstance(); cal.set(2010, 1, 1, 0, 0, 0);// w ww.j av a 2 s .c o m cal.set(Calendar.MILLISECOND, 0); // We do not preserve ms resolution if (!dateAndTime) { // calendar w/ date only return cal; } else { // add some time to it too cal.set(Calendar.HOUR_OF_DAY, 10); cal.set(Calendar.MINUTE, 20); cal.set(Calendar.SECOND, 30); cal.set(Calendar.MILLISECOND, 0); // We do not preserve ms resolution return cal; } } }