@@ -0,0 +1,1196 @@
+package leetcode;%0A%0A/**%0A * Created by Joshua.Chi %3Cjoshua.chi@akqa.com%3E%0A *%0A * @author joshua.chi%0A * @date 5/11/17%0A */%0Apublic class Fibonacci %7B%0A    int max = 4000000;%0A%0A    public int sum(int%5B%5D nums) %7B%0A        int r = 0;%0A        for(int i=0; i%3C nums.length; i++) %7B%0A            r += nums%5Bi%5D;%0A        %7D%0A        return r;%0A    %7D%0A%0A    public int cal(int%5B%5D nums, int result) %7B%0A        int next = sum(nums);%0A%0A        if (isEven(next)) %7B%0A            result += next;%0A        %7D%0A%0A        if (next %3E max) %7B%0A            System.out.println(next);%0A            return result;%0A        %7D%0A        nums = add(nums, next);%0A        return cal(nums, result);%0A    %7D%0A%0A    private int%5B%5D add(int%5B%5D nums, int next) %7B%0A        int%5B%5D newNums = new int%5Bnums.length+1%5D;%0A        for (int i=0; i%3C nums.length; i++) %7B%0A            newNums%5Bi%5D = nums%5Bi%5D;%0A        %7D%0A        newNums%5Bnums.length%5D = next;%0A        return newNums;%0A    %7D%0A%0A    private boolean isEven(int num) %7B%0A        if (num %25 2 == 0) %7B%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        Fibonacci f = new Fibonacci();%0A        int%5B%5D start = new int%5B%5D %7B1, 2%7D;%0A        System.out.print(f.cal(start, 0));%0A    %7D%0A%7D%0A

add fibonacci