public static int indexOf(byte[] b, byte[] sub) {
		if (b == null || sub == null) {
			return -1;
		}
		
		for (int i = 0; i < b.length - sub.length + 1; i++) {
			boolean matches = true;
			for (int j = 0; j < sub.length; j++) {
				if (b[i+j] != sub[j]) {
					matches = false;
				}
			}
			if (matches) {
				return i;
			}
		}
		
		return -1;
	}