Calculate the sum till the last index in crr [ ] which is less than N which contains a positive element
for ( int i = 0 ; i < N ; i ++ ) { if ( crr . get ( i ) > 0 ) { sum += crr . get ( i ) ; } else { break ; } }