Nzec error

Hello !

I’m trying to solve “A New Number System” problem, but i’m getting a NEZC Error. I don’t know what’s wrong with my code. Can anyone who knows the problem explain to me, please ? Thanks in advance. So here is the code :

import java.util.*;
public class Main{

public static void main(String [] args){
	String ligne;
	int cases;
	Scanner in = new Scanner(System.in);
		cases = myFunction(in.nextLine());
		ligne = in.nextLine();
		while(!ligne.equals("~")){
			if(!ligne.trim().equals("#")){
				System.out.println(myFunction(ligne));
			} 
			ligne = in.nextLine();
		}
}

public static int myFunction(String a){
	String flag = "";
	String entier = "";
	String l [] = a.split(" ");
	for(int i = 0; i < l.length; i++){
		if(l[i].equals("0")){
			flag = "1";
		}
		else if(l[i].equals("00")){
			flag = "0";
		}
		else if(l[i].equals("#")){
			break;
		}
		else{
			for(int j = 0; j < l[i].length()-2; j++){
				entier = entier.concat(flag);
			}
		}
	}
	return Integer.parseInt(entier, 2);
}

}