Here you can find the source of isLocalIpAddress(final InetAddress ipAddress)
private static boolean isLocalIpAddress(final InetAddress ipAddress)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; public class Main { private static boolean isLocalIpAddress(final InetAddress ipAddress) { return ipAddress.isSiteLocalAddress() && !ipAddress.isLoopbackAddress() && !isV6IpAddress(ipAddress); }//from ww w . j ava 2 s .c o m private static boolean isV6IpAddress(final InetAddress ipAddress) { return ipAddress.getHostAddress().contains(":"); } }