public void code(String s) {
        if(s==null){throw new IllegalArgumentException();}
        int alpha = 0;
        int i = 0;
        int j = 1;
        int len = s.length();
        while (i < s.length() && j <= s.length()) {
            String sub = s.substring(i, j);
            String sub2 = s.substring(i, j - 1);
            if (dict.containsKey(sub)) {// If in dictionnary, we increase search field
                j++;
                if (j - 1 == s.length()) {//If at the end of the String don't, just end code
                    code.append("E").append(dico(s.substring(i, j - 1)));
                    break;
                }
                continue;
            } else {// If not in dictionnary
                char lastCharofSub = s.charAt(j - 1);   //Next char
                boolean isNumber = false;   //IsNext char a number?
                try {
                    Integer.parseInt(Character.toString(lastCharofSub));
                    isNumber = true;
                } catch (NumberFormatException e) {
                    isNumber = false;
                }
                if (dico(sub2) == null) { //if subentry not in dictionnary then create new entry in dictionnary
                    dict.put(sub, alpha + 1);
                    if (isNumber == false) { //then put into code, without delimiters if lastchar is a number
                        code.append(lastCharofSub).append(0);
                    } else {//put into code with delimiters
                        code.append(delimiter).append(lastCharofSub).append(delimiter).append(0);
                    }

                } else {    //if subentry in dictionnary, create entry for entire entry
                    dict.put(sub, alpha + 1);
                    if (isNumber == false) {
                        code.append(s.charAt(j - 1)).append(dico(sub2));
                    } else {
                        code.append(delimiter).append(lastCharofSub).append(delimiter).append(dico(sub2));
                    }
                }
                alpha++;
            }
            i = j;
            j++;

        }
    }