KUID extends ByteArray<KUID> implements Identifier, 
    Key<KUID>, Xor<KUID>, Negation<KUID>, Cloneable, Digestable { public int commonPrefix(KUID otherId) { int bitIndex = bitIndex(otherId); if (bitIndex < 0) { switch (bitIndex) { case KeyAnalyzer.EQUAL_BIT_KEY: case KeyAnalyzer.NULL_BIT_KEY: return lengthInBits(); default: throw new IllegalStateException("bitIndex=" + bitIndex); } } return bitIndex; } private  KUID(byte[] key); static KUID createRandom(int length); static KUID createRandom(KUID otherId); static KUID create(byte[] key); static KUID create(byte[] key, int offset, int length); static KUID create(String key, int radix); static KUID createWithPrefix(KUID prefix, int bitIndex); static KUID min(int length); static KUID max(int length); @Override KUID getId(); boolean isCompatible(KUID otherId); @Override void update(MessageDigest md); @Override int lengthInBits(); @Override boolean isBitSet(int bitIndex); @Override int bitIndex(KUID otherId); @Override boolean isPrefixedBy(KUID prefix); @Override KUID xor(KUID otherId); @Override KUID negate(); KUID min(); KUID max(); KUID set(int bitIndex); KUID unset(int bitIndex); KUID flip(int bitIndex); int commonPrefix(KUID otherId); boolean isMin(); boolean isMax(); boolean isCloserTo(KUID key, KUID otherId); int compareTo(KUID key, KUID otherId); @Override int compareTo(KUID otherId); @Override KUID clone(); BigInteger toBigInteger();  }
@Test public void commonPrefix() { for (int i = 0; i < 1000; i++) { KUID a = KUID.createRandom(20); int bits = (int)(a.lengthInBits() * Math.random()); KUID b = KUID.createWithPrefix(a, bits); int common = a.commonPrefix(b); TestCase.assertTrue(common + " < " + bits, common >= bits); } }