this code
if (calendar.get(Calendar.HOUR_OF_DAY) < from.getHours())
return false;
if (calendar.get(Calendar.HOUR_OF_DAY) == from.getHours() && calendar.get(Calendar.MINUTE) < from.getMinutes())
return false;
if (calendar.get(Calendar.HOUR_OF_DAY) > till.getHours())
return false;
return !(calendar.get(Calendar.HOUR_OF_DAY) == till.getHours() && calendar.get(Calendar.MINUTE) > till.getMinutes());
is highlighted to be simplified
but result [which is 100% correct]
return calendar.get(Calendar.HOUR_OF_DAY) >= from.getHours() && !(calendar.get(Calendar.HOUR_OF_DAY) == from.getHours() && calendar.get(Calendar.MINUTE) <
from.getMinutes()) && calendar.get(Calendar.HOUR_OF_DAY) <= till.getHours() && !(calendar.get(Calendar.HOUR_OF_DAY) == till.getHours() &&
calendar.get(Calendar.MINUTE) > till.getMinutes());
does not look very simple for me. maybe we need to limit those simplifications?