public int solution(int N) {
    	if(N <= 0) return 0;
        int res = 0, cur = 0;
        boolean one = false;
        while(N > 0) {
            int bit = N % 2;
            N = N / 2;
            if(bit == 1) {
                one = true;
                cur = 0;
            } else {
                if(one == true || cur > 0) {
                    cur++;
                    if(cur > res) res = cur;
                }
                one = false;
            }
        }
        return res;
    }