code: public static int matchingNibbleLength(byte[] a, byte[] b) {
          int i = 0;
          int length = a.length < b.length ? a.length : b.length;
          while (i < length) {
              if (a[i] != b[i])
                  return i;
              i++;
          }
          return i;
      }
docs: Returns the amount of nibbles that match each other from 0 ... amount will
  never be larger than smallest input
  
  @param a
  first input
  @param b
  second input
  @return Number of bytes that match