'Excel: maximum of consecutive occurrences of a value in a row

I need a formula to calculate the maximum of consecutive occurrences of a value (value searched is 1) in the same row:

For example, for this row:

1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1

The formula result should be 4, since the maximum number of consecutive occurrences of the number 1 is 4.

Is it possible?

Many thanks for any help :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source