To obtain the length of an array, you can use the field-selection operator to obtain the value of the length instance variable:
length
durations.length