char[] ca = s.toCharArray();
// if we see a character that is neither a digit nor a period
// then s is probably a hostname
for (int i = 0; i < ca.length; i++) {
if (!Character.isDigit(ca[i])) {
if (ca[i] != '.") {
return true;
}
}
}
// Everything was either a digit or a period
// so s looks like an IP address in dotted quad format
return false;