Java tutorial
import java.time.DayOfWeek; import java.time.LocalDate; import java.util.Arrays; public class Main { public static void main(String[] args) { LocalDate[] a = nextWeekDay(LocalDate.now()); System.out.println(Arrays.toString(a)); } public static LocalDate[] nextWeekDay(LocalDate date) { if (date == null) { date = LocalDate.now(); } return getWeekday(date.plusWeeks(1)); } public static LocalDate[] getWeekday(LocalDate date) { int DAYS_OF_WEEK = 7; if (date == null) { date = LocalDate.now(); } LocalDate begin = null; if (date.getDayOfWeek().equals(DayOfWeek.SUNDAY)) { begin = date; } else { begin = date.minusDays(date.getDayOfWeek().getValue()); } LocalDate end = begin.plusDays(DAYS_OF_WEEK - 1); LocalDate localDate[] = { begin, end }; return localDate; } }