Sub array search
In this chapter you will learn:
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:
Home » Java Tutorial » Array