Here you can find the source of isLocalHost(String h1)
public static boolean isLocalHost(String h1)
//package com.java2s; import java.net.*; public class Main { public static boolean isLocalHost(String h1) { boolean ret = false; try {/*from w w w . ja v a 2 s .c o m*/ InetAddress a1 = InetAddress.getByName(h1); if (a1 != null) ret = InetAddress.getLocalHost().getHostAddress().equals(a1.getHostAddress()); } catch (UnknownHostException e) { } return ret; } }