class Solution { public int solution(int N) { String binaryN = Integer.toBinaryString(N); int max = 0; int nexMax = 0; for (char each : binaryN.toCharArray()) { if (each == '1') { max = Math.max(nexMax, max); nexMax = 0; } else { nexMax++; } } return max; } }