Here you can find the source of isLocal(final String hostname)
static boolean isLocal(final String hostname)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.net.InetAddress; import java.net.UnknownHostException; public class Main { static boolean isLocal(final String hostname) { try {/*from w w w .j a v a 2 s. co m*/ return InetAddress.getByName(hostname).isLoopbackAddress(); } catch (UnknownHostException e) { return false; } } }