Here you can find the source of isInNextWeek(long lTime)
public static boolean isInNextWeek(long lTime)
//package com.java2s; import java.util.Calendar; public class Main { public static boolean isInNextWeek(long lTime) { Calendar calToday = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); calToday.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfWeek = calToday.get(Calendar.DAY_OF_WEEK); if (nDayOfWeek == Calendar.SUNDAY) { nDayOfWeek = Calendar.SATURDAY + 1; }/* w w w. j a va 2 s.c o m*/ nDayOfWeek -= 1; calToday.add(Calendar.DAY_OF_YEAR, 8 - nDayOfWeek); if (calUnknown.before(calToday)) { return false; } calToday.add(Calendar.DAY_OF_YEAR, 7); if (calUnknown.after(calToday)) { return false; } return true; } }