@Test public void testCommonPrefixLength() { Cidr c1 = new Cidr("10.0.0.0/8"); Cidr c2 = new Cidr("11.0.0.0/8"); Assert.assertEquals(c1.commonPrefixLength(c2), 7); Assert.assertEquals(c2.commonPrefixLength(c1), 7); Assert.assertEquals(c2.commonPrefix(c1), c1.commonPrefix(c2)); Assert.assertEquals(c2.commonPrefix(c1), new Cidr("10.0../7")); Cidr c1s = new Cidr("10.0../6"); Assert.assertEquals(c2.commonPrefixLength(c1s), 6); Assert.assertTrue(c1s.contains(c1)); Assert.assertTrue(c1s.contains(c2)); Assert.assertFalse(c1.contains(c2)); Assert.assertFalse(c2.contains(c1)); }
public int commonPrefixLength(Cidr other) { return asBitList().commonPrefixLength(other.asBitList()); }
Cidr implements Serializable { public int commonPrefixLength(Cidr other) { return asBitList().commonPrefixLength(other.asBitList()); } }
Cidr implements Serializable { public int commonPrefixLength(Cidr other) { return asBitList().commonPrefixLength(other.asBitList()); } Cidr(String cidr);  Cidr(int ...unsignedBytes);  Cidr(int[] subnetBytes, int length); }
Cidr implements Serializable { public int commonPrefixLength(Cidr other) { return asBitList().commonPrefixLength(other.asBitList()); } Cidr(String cidr);  Cidr(int ...unsignedBytes);  Cidr(int[] subnetBytes, int length); static boolean isCanonical(String cidr); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); int[] getBytes(); int getLength(); Cidr subnet(int ...extraUnsignedBytes); InetAddress netmask(); InetAddress addressAtOffset(int offset); int commonPrefixLength(Cidr other); Cidr commonPrefix(Cidr other); BitList asBitList(); boolean contains(Cidr target); @Deprecated static InetAddress getInetAddressWithFixedName(byte[] ip); }
Cidr implements Serializable { public int commonPrefixLength(Cidr other) { return asBitList().commonPrefixLength(other.asBitList()); } Cidr(String cidr);  Cidr(int ...unsignedBytes);  Cidr(int[] subnetBytes, int length); static boolean isCanonical(String cidr); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); int[] getBytes(); int getLength(); Cidr subnet(int ...extraUnsignedBytes); InetAddress netmask(); InetAddress addressAtOffset(int offset); int commonPrefixLength(Cidr other); Cidr commonPrefix(Cidr other); BitList asBitList(); boolean contains(Cidr target); @Deprecated static InetAddress getInetAddressWithFixedName(byte[] ip); static final Cidr UNIVERSAL; static final Cidr _10; static final Cidr _172_16; static final Cidr _192_168; static final Cidr CLASS_A; static final Cidr CLASS_B; static final Cidr CLASS_C; static final List<Cidr> PRIVATE_NETWORKS_RFC_1918; static final Cidr _169_254; static final Cidr LINK_LOCAL; static final Cidr _127; static final Cidr LOOPBACK; static final List<Cidr> NON_PUBLIC_CIDRS; }