Here you can find the source of get_NextSunday_YearMonthDay_integerArray()
@SuppressWarnings("deprecation") public static int[] get_NextSunday_YearMonthDay_integerArray()
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { @SuppressWarnings("deprecation") public static int[] get_NextSunday_YearMonthDay_integerArray() { Date objDateLocal = new Date(); Calendar objCalendarLocal = Calendar.getInstance(); int nLocal_DD = 0; int nLocal_MM = 0; objCalendarLocal.setTime(objDateLocal); nLocal_DD = objCalendarLocal.get(Calendar.DATE); nLocal_MM = objCalendarLocal.get(Calendar.MONTH); int nLocal_MaxDayCount = objCalendarLocal .getActualMaximum(Calendar.DAY_OF_MONTH); if (nLocal_MM == 1) { // Feb is actually 1 if (nLocal_DD > 23) { objCalendarLocal.set(Calendar.MONTH, Calendar.MONTH + 1); objDateLocal.setMonth(objCalendarLocal.get(Calendar.MONTH)); }//from www . j a v a 2 s. c o m } else { if (nLocal_DD > 25 && nLocal_MaxDayCount == 31) { objCalendarLocal.set(Calendar.MONTH, Calendar.MONTH + 1); objDateLocal.setMonth(objCalendarLocal.get(Calendar.MONTH)); nLocal_MM = objDateLocal.getMonth(); if (nLocal_MM > 11) { objCalendarLocal.set(Calendar.YEAR, Calendar.YEAR + 1); objDateLocal.setYear(objCalendarLocal .get(Calendar.YEAR)); } } if (nLocal_DD > 24 && nLocal_MaxDayCount == 30) { objCalendarLocal.set(Calendar.MONTH, Calendar.MONTH + 1); objDateLocal.setMonth(objCalendarLocal.get(Calendar.MONTH)); } } objCalendarLocal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); objDateLocal.setDate(objCalendarLocal.get(Calendar.DATE) + 9); objCalendarLocal.setTime(objDateLocal); int[] nArr_Current_YearMonthDay = { objCalendarLocal.get(Calendar.YEAR), objCalendarLocal.get(Calendar.MONTH) + 1, // due to Java implementation need to add +1 to months count objCalendarLocal.get(Calendar.DATE) }; return nArr_Current_YearMonthDay; } }