String out = new String(); boolean CC = str.startsWith("["); int menuLevel = 0;  StringTokenizer st = new StringTokenizer(str, "[]", true); while (st.hasMoreTokens()) { String tmp = st.nextToken();   if (tmp.length() <= 2) { if (tmp.equals("[")) CC = true; else if (tmp.equals("]")) CC = false; else if (CC && tmp.equals("02")) menuLevel--; out += tmp;  } else { if (CC && (tmp.startsWith("02") || tmp.startsWith("2"))) menuLevel--; if (CC && (tmp.endsWith("19 02") || tmp.endsWith("19 2"))) menuLevel++; out += (CC || menuLevel != 0 ? tmp : compressStringNoCC(tmp, c));  } }  return out;
    public String compressString(String str)    {        if (allowComp)            return compressString(str, 0);        else            return str;    }