Here you can find the source of isThisMe(String hostname)
private static boolean isThisMe(String hostname)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; public class Main { private static boolean isThisMe(String hostname) { try {/*from w w w.j a v a 2s .c om*/ InetAddress[] myadds = getHostAddresses(); InetAddress[] theiradds = InetAddress.getAllByName(hostname); for (int i = 0; i < theiradds.length; i++) { if (theiradds[i].isLoopbackAddress()) { return true; } for (int j = 0; j < myadds.length; j++) { if (myadds[j].equals(theiradds[i])) { return true; } } } } catch (Exception e) { } return false; } public static InetAddress[] getHostAddresses() { try { String hname = getHostName(); if (hname == null) { return null; } return InetAddress.getAllByName(hname); } catch (Exception e) { return null; } } public static String getHostName() { try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { return null; } } }