Spot the bug in the total loop

from Java language fundamentals
Java 25 LTS beginner 4 min 1 issue to find

Find the boundary bug in this total calculation.

Java
static int total(int[] values) {
    int sum = 0;
    for (int index = 0; index <= values.length; index++) {
        sum = Math.addExact(sum, values[index]);
    }
    return sum;
}
Open in playground
Report an error