title: Java: Convert a String (representing an IP) to InetAddress
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2309049/is-there-an-easy-way-to-convert-string-to-inetaddress-in-java">Is there an easy way to convert String to Inetaddress in Java?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm  trying to convert a string(representing an IP address, e.g. <code>10.0.2.50</code>) into an <code>InetAddress</code> obj. </p>
  
  <p>According to the API it is possible to create an Object providing a String representing a hostname (e.g. <code>www.google.ch</code>). This is not an option for me since I do not have the hostname for each InetAddress object I want to create(besides that it takes too long).</p>
  
  <p>Is it possible to convert a String (e.g. <code>10.0.2.50</code>) into an <code>InetAddress</code> obj.? (according to the api it is possible to do so if you have the IP as <code>byte[]</code>, but how do I convert a <code>String</code> containing an IP into <code>byte[]</code>?)</p>