public static int indexOf(byte[] array, byte[] target, int fromIndex) {

        if (array == null || target == null) {
            return -1;
        }

        // Target cannot be beyond array boundaries
        if (fromIndex < 0 || (fromIndex > (array.length - target.length))) {
            return -1;
        }

        // Empty is assumed to be at the fromIndex of any non-null array (after
        // boundary check)
        if (target.length == 0) {
            return fromIndex;
        }

        firstbyte: for (int i = fromIndex; i < array.length - target.length + 1; i++) {
            for (int j = 0; j < target.length; j++) {
                if (array[i + j] != target[j]) {
                    continue firstbyte;
                }
            }
            return i;
        }
        return -1;
    }
Returns the index (start position) of the first occurrence of the specified {@code target}
within {@code array} starting at {@code fromIndex} , or {@code -1} if there is no such
occurrence.

Returns the lowest index {@code k} such that {@code k >= fromIndex} and {@code
java.util.Arrays.copyOfRange(array, k, k + 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}
@param fromIndex the index to start the search from in {@code array}
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/ByteUtil.java