return Math.abs(timestamp1.getTimeInMillis() - timestamp2.getTimeInMillis()) < ONE_DAY_IN_MILLIS;
long sessionLength = ONE_DAY_IN_MILLIS - (startTime.getTimeInMillis() - endTime.getTimeInMillis());  long timeInMillis1 = timestamp1.getTimeInMillis(); long timeInMillis2 = timestamp2.getTimeInMillis();  if (timestamp1.after(timestamp2)) { long delta = getTimeOnly(timestamp2, calendar1).getTimeInMillis() - startTime.getTimeInMillis();  if (delta < 0) { delta = ONE_DAY_IN_MILLIS + delta; }  return (timeInMillis1 - timeInMillis2) < (sessionLength - delta); } else { return (timeInMillis2 - timeInMillis1) < sessionLength; }
    private boolean isSameDailySession(Calendar timestamp1, Calendar timestamp2) {        if (!isDailySessionTime(timestamp1) || !isDailySessionTime(timestamp2)) {            return false;        }        if (timestamp1.equals(timestamp2)) {            return true;        }        Calendar date1 = getDateOnly(timestamp1, calendar1);        Calendar date2 = getDateOnly(timestamp2, calendar2);        if (startTime.before(endTime) || startTime.equals(endTime)) {            return date1.equals(date2);        } else {            return Math.abs(timestamp1.getTimeInMillis() - timestamp2.getTimeInMillis()) < ONE_DAY_IN_MILLIS;        }    }