Here you can find the source of isLastDayOfMonth(String theDataStr)
public static boolean isLastDayOfMonth(String theDataStr)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { private static final int[] DAY_OF_MONTH = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; public static boolean isLastDayOfMonth(String theDataStr) { Date theDate = java.sql.Date.valueOf(theDataStr); Calendar c = new GregorianCalendar(); c.setTime(theDate);//from w w w.j a v a 2 s . c o m int nowDay = c.get(Calendar.DAY_OF_MONTH); c.set(Calendar.DAY_OF_MONTH, 1); c.add(Calendar.MONTH, 1); c.add(Calendar.DAY_OF_MONTH, -1); int lowDayOfMonth = c.get(Calendar.DAY_OF_MONTH); if (nowDay == lowDayOfMonth) { return true; } else { return false; } } public static int get(Date date, int type) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(type); } }