Here you can find the source of getNextMonthDays(String argDate)
public static int getNextMonthDays(String argDate)
//package com.java2s; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static int getNextMonthDays(String argDate) { String[] temp = null;// www.j a v a 2 s . c om if (argDate.indexOf("/") > 0) { temp = argDate.split("/"); } if (argDate.indexOf("-") > 0) { temp = argDate.split("-"); } Calendar cal = new GregorianCalendar(Integer.valueOf(temp[0]) .intValue(), Integer.valueOf(temp[1]).intValue() - 1, Integer.valueOf(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]; } }