title: How do I test the availability of the internet in Java?
body: <p>I don't want to tell the hard way that the internet is unavailable when I catch an exception from url.openStream(). </p>
  
  <p>Is there a simple way to tell if the computer is connected to the internet in Java?
  In this scenario, "connected to the internet" means being able to download data from a specific url. </p>
  
  <p>If I try to download from it and it is not available, then the program hangs for a bit. I dont want that hanging. Therefore, i need a fast way of querying whether the website is available or not. </p>