Util { public static boolean identical(byte[] b, byte[] b2) { if (b == null || b2 == null) { return false; } if (b.length != b2.length) { return false; } for(int i = 0; i < b.length; i ++) { if (b[i] != b2[i]) { return false; } } return true; } private  Util(); static byte[] addressToBytes(String address); static boolean identical(byte[] b, byte[] b2); static void validatePort(int port); static InetSocketAddress computeLocalEndpoint(
            NetworkInterface ni, InetAddress localAddress, Integer localPort, InetAddress address, Integer port); static boolean isIPv4(InetAddress a); static boolean isIPv6(InetAddress a); static String inetAddressToString(InetAddress a); static void displayInfo(); static void dumpState(Configuration c, DatagramSocket s, DatagramPacket p); static String truncate(byte[] payload, int length); static final Pattern IPv4_FORMAT; }
@Test public void identical() throws Exception { byte[] b = new byte[] {127, 0, 0, 1}; byte[] b2 = new byte[] {127, 0, 0, 1}; assertTrue(Util.identical(b, b2)); }
@Test public void identical_NotSo() throws Exception { byte[] b = new byte[] {127, 0, 0, 1}; byte[] b2 = new byte[] {127, 0, 0, 2}; assertFalse(Util.identical(b, b2)); }
@Test public void identical_NotSo_Length() throws Exception { byte[] b = new byte[] {127, 0, 0, 1, 2}; byte[] b2 = new byte[] {127, 0, 0, 1}; assertFalse(Util.identical(b, b2)); }