private static String combine(ArrayList<String> digits){
        ArrayList<String> list = new ArrayList<String>(digits);
        StringBuilder builder = new StringBuilder();
        String first = list.remove(0);
        if(first.length() >= 2 && first.charAt(0) == '0'){
            return "";
        }
        int ip = Integer.parseInt(first);
        if(ip >= 0 && ip <= 255)
            builder.append(ip);
        else{
            return "";
        }
        for(String s : list){
            if(s.length() >= 2 && s.charAt(0) == '0'){
                return "";
            }
            ip = Integer.parseInt(s);
            if(ip >= 0 && ip <= 255){
                builder.append(".");
                builder.append(ip);
            }
            else{
                return "";
            }
        }
        return builder.toString();
    }