public static int indexOf(byte[] array, byte[] target) {
    checkNotNull(array, "array");
    checkNotNull(target, "target");
    if (target.length == 0) {
      return 0;
    }

    outer: for (int i = 0; i < array.length - target.length + 1; i++) {
      for (int j = 0; j < target.length; j++) {
        if (array[i + j] != target[j]) {
          continue outer;
        }
      }
      return i;
    }
    return -1;
  }
Returns the start position of the first occurrence of the specified {@code
target} within {@code array}, or {@code -1} if there is no such occurrence.
<p>
More formally, returns the lowest index {@code i} such that {@code
java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly the same elements
as {@code target}.
@param array  the array to search for the sequence {@code target}
@param target the array to search for as a sub-sequence of {@code array}
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java