JAVA 判断host 是否可用

public static boolean isHostReachable(String host, Integer timeOut) {
    try {
        return InetAddress.getByName(host).isReachable(timeOut);
    } catch (UnknownHostException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return false;
}