complete guess:
Is it possible that the following line of code is never true?
if(ser==co[j])
ah, yes it is possible. NOw that I look at it closer you are doing ser (string)
comparison but the comparison in that line actually compares the two objects (and they are never equal.
Then, since it is never true, the flag never gets set to 1.
You have to do string comparison differently in Java. Change line to:
if(ser.equals(co[j]))