Here you can find the source of getLastDayOfWeek(int year, int month)
public static int getLastDayOfWeek(int year, int month)
//package com.java2s; import java.util.*; public class Main { public static int getLastDayOfWeek(int year, int month) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DATE, 0); return calendar.get(Calendar.WEEK_OF_MONTH); }// w w w . j a v a2s .co m }