Risolto
bastavano due righe.... a chi servissero eccole qui
Data la stringa ipAddress contenete l'indirizzo ip
Pattern pattern = Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
Matcher matcher = pattern.matcher(ipAddress);
if (matcher.matches());
...
...
Grazie a tutti per l'aiuto