Here you can find the source of getLastMonthDays(Calendar c)
public static int getLastMonthDays(Calendar c)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static int getLastMonthDays(Calendar c) { Calendar calendar = c;//www . java 2 s . c om calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); } }