IP Address conversion to hostname in Java

Just another java tip:

 

If you know the ip address of a PC, you can get its hostname over network using following code –

 

String hostname = InetAddress.getByName("192.18.97.39").getHostName();