public boolean valid(String ip){
        if(ip.length() > 3 || ip.length() <1 )
            return false;
        if(ip.length() > 1 && ip.charAt(0) == '0')
            return false;
        if(Integer.parseInt(ip) > 255)
            return false;
        else
            return true;
    }