public static int indexOf(byte[] src,byte[] target,int fromIdx){
  final int to=src.length - target.length + 1;
  for (int i=fromIdx; i < to; i++) {
    if (src[i] == target[0]) {
      boolean equals=true;
      for (int j=1, k=i + 1; j < target.length && equals; j++, k++) {
        if (src[k] != target[j]) {
          equals=false;
        }
      }
      if (equals) {
        return i;
      }
    }
  }
  return -1;
}

public static int indexOf ( byte [ ] src , byte [ ] target , int fromIdx ) { final int to = src . length - target . length + 1 ; for ( int i = fromIdx ; i < to ; i ++ ) { if ( src [ i ] == target [ 0 ] ) { boolean equals = true ; for ( int j = 1 , k = i + 1 ; j < target . length && equals ; j ++ , k ++ ) { if ( src [ k ] != target [ j ] ) { equals = false ; } } if ( equals ) { return i ; } } } return - 1 ; }
searches for target bytes in the source bytes .
