package leetcode;

/**
 * https://leetcode.com/problems/max-consecutive-ones/
 */
public class Problem485 {
    public int findMaxConsecutiveOnes(int[] nums) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem485 prob = new Problem485();
        System.out.println(prob.findMaxConsecutiveOnes(new int[]{1, 1, 0, 1, 1, 1})); // 3
    }
}

@@ -165,38 +165,49 @@
     
-// TODO%0A        return
+int max = 0;%0A        int tmpMax =
  0;%0A    
 %7D%0A%0A 
@@ -206,190 +206,243 @@
     
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem485 prob = new Problem485();%0A        System.out.println(prob.findMaxConsecutiveOnes(new int%5B%5D%7B1, 1, 0, 1, 1, 1%7D)); // 3
+for (int i = 0; i %3C nums.length; i++) %7B%0A            if (nums%5Bi%5D == 1) %7B%0A                tmpMax++;%0A            %7D else %7B%0A                tmpMax = 0;%0A            %7D%0A            max = Math.max(max, tmpMax);%0A        %7D%0A        return max;
 %0A   

Solve problem 485