How to find the length of the longest consecutive bit string(either 1 or 0)?
00000000 11110000 00000000 00000000 -> If it is 0 then length will be 20
11111
It may help you.... First convert your binary number to String say bits. It will give you max number of consecutive 1's (in java)
String[] split = bits.split("0"); Arrays.sort(split); int maxLength = split[split.length - 1].length();