package com.ardverk.utils;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Arrays;

import org.ardverk.net.NetworkMask;

public class NetworkUtils {

    private NetworkUtils() {}
    
    /**
     * Returns true if both {@link SocketAddress}es have the same {@link InetAddress}
     */
    public static boolean isSameAddress(SocketAddress a1, SocketAddress a2) {
        if (a1 == null) {
            throw new NullPointerException("address1");
        }
        
        if (a2 == null) {
            throw new NullPointerException("address2");
        }
        
        return ((InetSocketAddress)a1).getAddress().equals(
                ((InetSocketAddress)a2).getAddress());
    }
    
    public static boolean isSameNetwork(SocketAddress a1, 
            SocketAddress a2, NetworkMask mask) {
        
        if (a1 == null) {
            throw new NullPointerException("address1");
        }
        
        if (a2 == null) {
            throw new NullPointerException("address2");
        }
        
        if (mask == null) {
            throw new NullPointerException("mask");
        }
        
        return Arrays.equals(mask.mask(a1), mask.mask(a2));
    }
    
    public static boolean isValidPort(int port) {
        return 0 < port && port < 0xFFFF;
    }
    
    public static boolean isValidPort(SocketAddress address) {
        return isValidPort(((InetSocketAddress)address).getPort());
    }
}

@@ -119,70 +119,8 @@
 ess;
-%0Aimport java.util.Arrays;%0A%0Aimport org.ardverk.net.NetworkMask;
 %0A%0Apu
@@ -693,498 +693,8 @@
    %0A
-    public static boolean isSameNetwork(SocketAddress a1, %0A            SocketAddress a2, NetworkMask mask) %7B%0A        %0A        if (a1 == null) %7B%0A            throw new NullPointerException(%22address1%22);%0A        %7D%0A        %0A        if (a2 == null) %7B%0A            throw new NullPointerException(%22address2%22);%0A        %7D%0A        %0A        if (mask == null) %7B%0A            throw new NullPointerException(%22mask%22);%0A        %7D%0A        %0A        return Arrays.equals(mask.mask(a1), mask.mask(a2));%0A    %7D%0A    %0A
     

Removing the static isSameNetwork() method