Here you can find the source of getCalendar()
public static Calendar getCalendar()
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static Calendar getCalendar() { return getCalendar(null); }/*from ww w . j a v a2 s . c o m*/ public static Calendar getCalendar(Integer year) { return getCalendar(year, null, null); } public static Calendar getCalendar(Integer year, Integer month) { return getCalendar(year, month, null); } public static Calendar getCalendar(Integer year, Integer month, Integer date) { Calendar calendar = Calendar.getInstance(); if (year != null) calendar.set(Calendar.YEAR, year); if (month != null) calendar.set(Calendar.MONTH, month - 1); if (date != null) calendar.set(Calendar.DAY_OF_MONTH, date); return calendar; } }