public ArrayList<String> restoreIpAddresses(String s) {
	    
    	ArrayList<String>  rst = new ArrayList<String>();
    	
    	if (s == null || s.length() < 4 || s.length() > 12) return rst;
    	int[] buf = new int[4];
    	for (int i =1;i<4;i++)
    	{
    		
    		int vl = -1;
    		try {
    			vl = Integer.valueOf(s.substring(0,i));
    		} catch (Exception e) {
				return rst;
			}
    		if (0<= vl && vl <= 255)
    		{
    			buf[0] = vl;
    			search(buf,s.substring(i),1,rst);
    		}
    		if (vl == 0) break;
    	}
        return rst;
    }