Here you can find the source of getNextMonthDays(String argDate)
public static int getNextMonthDays(String argDate)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static int getNextMonthDays(String argDate) { String[] temp = null;// www . j a v a2 s . com if (argDate.indexOf("/") > 0) { temp = argDate.split("/"); } if (argDate.indexOf("-") > 0) { temp = argDate.split("-"); } Calendar cal = new GregorianCalendar( new Integer(temp[0]).intValue(), new Integer(temp[1]).intValue() - 1, new Integer(temp[2]).intValue()); int curMonth = cal.get(Calendar.MONTH); cal.set(Calendar.MONTH, curMonth + 1); int curyear = cal.get(Calendar.YEAR); curMonth = cal.get(Calendar.MONTH); int mArray[] = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if ((curyear % 400 == 0) || ((curyear % 100 != 0) && (curyear % 4 == 0))) { mArray[1] = 29; } return mArray[curMonth]; } }