Here you can find the source of ArrayIndexOf(byte[] data, byte[] dest)
public static int ArrayIndexOf(byte[] data, byte[] dest)
//package com.java2s; //License from project: Apache License public class Main { public static int ArrayIndexOf(byte[] data, byte[] dest) { return ArrayIndexOf(data, dest, 0); }/* ww w . ja va 2 s .c o m*/ public static int ArrayIndexOf(byte[] data, byte[] dest, int start) { if (data == null || data.length == 0 || dest == null || dest.length == 0 || data.length < dest.length || start < 0) { return -1; } for (int i = start; i < data.length; i++) { boolean found = true; for (int j = 0; j < dest.length; j++) { if (data[i + j] != dest[j]) { found = false; break; } } if (found) { return i; } } return -1; } }