Sub array search

In this chapter you will learn:

  1. Start with one array

Start with one array

public class Main {
/*from  j a  v a 2  s.  co m*/
  public static boolean startsWith(byte[] source, int offset, byte[] match) {

    if (match.length > (source.length - offset)) {
      return false;
    }

    for (int i = 0; i < match.length; i++) {
      if (source[offset + i] != match[i]) {
        return false;
      }
    }
    return true;
  }

}

Next chapter...

What you will learn in the next chapter:

  1. Subarray from array that starts at offset
Home » Java Tutorial » Array
Java Array
Create an Array
Array Index and length
Multidimensional Arrays
Array examples
Array copy
Array compare
Array Binary search
Array Search
Array sort
Array to List
Convert array to Set
Array fill value
Array to String
Array element reverse
Array element delete
Array shuffle
Array element append
Array min / max value
Sub array search
Get Sub array
Array dimension reflection
Array clone