private static boolean compareByteValues ( byte [ ] network , byte [ ] subnet , byte [ ] ipAddress ) { for ( int i = 0 ; i < network . length ; i ++ ) if ( ( network [ i ] & subnet [ i ] ) != ( ipAddress [ i ] & subnet [ i ] ) ) return false ; return true ; }
Checks whether ipAddress is in network with specified subnet by comparing byte logical end values