Facing a Runtime Error for First Test case in Second Set for the Problem "PINBS"

I tried the problem in java as well as Python with the same logic.
The Python solution got accepted but Java one doesn’t. I have a standard template for my java solutions which I use for Fast I/O and some basic Utilities(Which is anyways not used in this solution).
Can anyone look and help that would actually be a great help.
Thanks in advance :slight_smile:
Problem Link: Prime in a binary string
My Java Solution: Java
Python Solution: Python

Crashes on this testcase.

                if (cnt != 0) /*<-- Hmmm. */{ 
                        break;
                    }
                    else {
                       continue; 
                    }
                }
                buf[cnt++] = (byte)c;
                if(cnt == buffLen) {
                    toReturn.append(new String(buf, 0, cnt));
                    cnt = 0; // <-- Yikes!
1 Like