Here you can find the source of isLocalHostNameInList(String[] hostList)
static public boolean isLocalHostNameInList(String[] hostList)
//package com.java2s; /**/* www . j av a 2s .c om*/ * Logback: the reliable, generic, fast and flexible logging framework. * Copyright (C) 1999-2013, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by * the Eclipse Foundation * * or (per the licensee's choosing) * * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. */ import java.net.InetAddress; import java.net.UnknownHostException; public class Main { static public boolean isLocalHostNameInList(String[] hostList) { String localHostName = getLocalHostName(); if (localHostName == null) { return false; } for (String host : hostList) { if (host.equalsIgnoreCase(localHostName)) { return true; } } return false; } static public String getLocalHostName() { InetAddress localhostIA; try { localhostIA = InetAddress.getLocalHost(); return localhostIA.getHostName(); } catch (UnknownHostException e) { return null; } } }