You will always have at least one ascending sequence of lines with a length of 1. Just change the days to 1 and they will work.
int maxDays = Math.min(1, MOODS.size()); int days = 1; for (int i = 0; i < MOODS.size() - 1; i++) { if (MOODS.get(i + 1) > MOODS.get(i)) { days += 1; if (days>maxDays){ maxDays=days; } } else { days = 1; } } return maxDays;
source share