if (i == 4) { return (new InetAddress(ip)); }
if (i == 4) { return (new Inet4Address(ip)); }
    public static InetAddress getByName(String hostname)            throws UnknownHostException {        // Default to current host if necessary        if (hostname == null) return getLocalHost();        // First, check to see if it is an IP address. If so, then don't        // do a DNS lookup.        StringTokenizer st = new StringTokenizer(hostname, ".");        if (st.countTokens() == 4) {            int i;            byte[] ip = new byte[ 4];            for (i = 0; i < 4; i++) {                try {                    ip[ i] = Byte.parseByte(st.nextToken());                    if ((ip[ i] < 0) || (ip[ 1] > 255)) break;                } catch (NumberFormatException e) {                    break;                }            }            if (i == 4) { return (new InetAddress(ip)); }        }        // Wasn't an IP, so try the lookup        InetAddress[] addresses = getAllByName(hostname);        return addresses[ 0];    }