Efficient way of BinaryGap
Unused Imports

import javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction;


This is never used, so why have it?

Useless Comments

// TODO Auto-generated method stub


Clearly, you've implemented the method.  Remove the TODO comment.



Singletons

Solution s = new Solution();
int x = s.solution(1041);


Solution is a class with no data members, just one function.  There is no reason to make an instance of this class, just make the method static.   Actually, there is no obvious reason to have the Solution class; you can make solution() a static member function in Main.


Pointless Box

Integer maxCountZeroList = 0;


There is no reason to have maxCountZeroList an object.  An int would be sufficient.  Since solutions() returns an int, and ends with return maxCountZeroList;, you are unboxing this integer anyway.

One Pass

You are doing two passes over your data.  The first pass you are counting non-'1' characters, and storing the counts in a List.  The second pass, this time over the list, you are looking for the max() value.

This can be done in one pass.

int countZero = 0;
int maxCountZero = 0;

String nBin = Integer.toBinaryString(N);
for (int i=1;i&lt;nBin.length();i++) {

    if(nBin.charAt(i) == '1')
    {
        if (countZero &gt; maxCountZero)
            maxCountZero = countZero;

        countZero = 0;
    }
    else
    {
        countZero++;
    }

}
return maxCountZero;


Enhanced For Loop

Instead of looping over the indices of nBin, and then calling .charAt() at each index (the only place the index is used), you could instead loop over the characters of the string, eliminating the need for the .charAt() call.

for (char ch : nBin.toCharArray()) {

    if(ch == '1')
    {
        if (countZero &gt; maxCountZero)
            maxCountZero = countZero;

        countZero = 0;
    }
    else
    {
        countZero++;
    }

}


Looking for the wrong thing

This code is not counting "zeros".  It is counting "not ones".  It would be clearer written as:

for (char ch : nBin.toCharArray()) {

    if(ch == '0')
    {
        countZero++;
    }
    else
    {
        if (countZero &gt; maxCountZero)
            maxCountZero = countZero;

        countZero = 0;
    }
}




Efficiency Improvement

@Harshal's improved solution is a bit obfuscated, but it does run in \$O(gap)\$ time.  Here is a less obfuscated implementation which runs in \$O({numGaps})\$ time.

int max_gap = 0;

n &gt;&gt;&gt;= Integer.numberOfTrailingZeros(n);   // Get rid of ending 0's.
n &gt;&gt;&gt;= Integer.numberOfTrailingZeros(~n);  // Get rid of ending 1's.

while (n &gt; 0) {
    int gap = Integer.numberOfTrailingZeros(n);
    if (gap &gt; max_gap)
        max_gap = gap;

    n &gt;&gt;&gt;= gap;
    n &gt;&gt;&gt;= Integer.numberOfTrailingZeros(~n);
} 

return max_gap;


Assuming Integer.numberOfTrailingZeros(x) executes in constant time, the above while loop will execute once for each "gap", computing exactly how long each gap is.  With 0x40000001, Harshal's method must loop 31 times, where as this algorithm loops only once.  In contrast, with 0x55555555, this algorithm loops 15 times, finding each gap of one '0', where as Harshal's algorithm loops once; the maximum gap size.

Profiling, and knowledge of the distribution of values, will be important in choosing between the two optimizations.