public static PingResult doJavaPing(InetAddress ia, PingOptions pingOptions) {
        PingResult pingResult = new PingResult(ia);

        if (ia == null) {
            pingResult.isReachable = false;
            return pingResult;
        }

        try {
            long startTime = System.nanoTime();
            final boolean reached = ia.isReachable(null, pingOptions.getTimeToLive(), pingOptions.getTimeoutMillis());
            pingResult.timeTaken = (System.nanoTime() - startTime) / 1e6f;
            pingResult.isReachable = reached;
            if (!reached) pingResult.error = "Timed Out";
        } catch (IOException e) {
            pingResult.isReachable = false;
            pingResult.error = "IOException: " + e.getMessage();
        } catch (NullPointerException e) {
            pingResult.isReachable = false;
            pingResult.error = "NullPointerException: " + e.getMessage();
        }
        return pingResult;
    }
Tries to reach this {@code InetAddress}. This method first tries to use
ICMP <i>(ICMP ECHO REQUEST)</i>, falling back to a TCP connection
on port 7 (Echo) of the remote host.

@param ia            - address to ping
@param pingOptions   - ping command options
@return - the ping results
library/src/main/java/com/stealthcopter/networktools/ping/PingTools.java