public static void main(String[] args) throws Exception {
String addr = getMachineNameFromIP("192.168.1.159");
System.out.println(addr);
}
static String getMachineNameFromIP(String ipAddr) {
try {
InetAddress i = InetAddress.getByName(ipAddr);
return i.getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
return "NULL";
}
}