Here you can find the source of isMulticastAddress(InetAddress ipAddr)
public static boolean isMulticastAddress(InetAddress ipAddr)
//package com.java2s; /*/*from ww w.j av a 2 s . c om*/ * NetUtils.java * * This file is part of the IHMC Util Library * Copyright (c) 1993-2016 IHMC. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 3 (GPLv3) as published by the Free Software Foundation. * * U.S. Government agencies and organizations may redistribute * and/or modify this program under terms equivalent to * "Government Purpose Rights" as defined by DFARS * 252.227-7014(a)(12) (February 2014). * * Alternative licenses that allow for use within commercial products may be * available. Contact Niranjan Suri at IHMC (nsuri@ihmc.us) for details. */ import java.net.InetAddress; public class Main { public static boolean isMulticastAddress(String ipAddr) { try { return isMulticastAddress(InetAddress.getByName(ipAddr)); } catch (Exception e) { return false; } } public static boolean isMulticastAddress(InetAddress ipAddr) { int firstOctet = ipAddr.getAddress()[0]; if (firstOctet < 0) { firstOctet += 255; } return ((firstOctet >= 224) && (firstOctet < 240)); } }