import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import sun.net.util.IPAddressUtil;
...
String ipadr;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
do {
System.out.print("IP-Addresse: ");
ipadr = reader.readLine();
} while (!IPAddressUtil.isIPv4LiteralAddress(ipadr));
} catch (IOException e) {
e.printStackTrace();
return;
}