Here you can find the source of calToLastDayOfMonth(Calendar c)
public static synchronized void calToLastDayOfMonth(Calendar c)
//package com.java2s; import java.util.Calendar; public class Main { public static synchronized void calToLastDayOfMonth(Calendar c) { int day = lastDayOfMonth(c); c.set(Calendar.DATE, day); }// w w w. j a va 2s .c om public static synchronized int lastDayOfMonth(Calendar c) { // final int[] daysPerMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, // 30, 31}; // int month = c.get(Calendar.MONTH); // return daysPerMonth[month]; return c.getActualMaximum(Calendar.DATE); } }