Here you can find the source of arrayContains(byte[] a, int offset, byte[] b)
Parameter | Description |
---|---|
a | haystack |
offset | starting index in haystack for the comparison |
b | needle |
private static boolean arrayContains(byte[] a, int offset, byte[] b)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . jav a2 s . c om*/ * Returns true if an array's elements appear inside another array. * * @param a haystack * @param offset starting index in haystack for the comparison * @param b needle * @return true if every byte of needle matches haystack, beginning at start */ private static boolean arrayContains(byte[] a, int offset, byte[] b) { if (a.length < offset + b.length) return false; for (int i = 0; i < b.length; i++) { if (a[offset + i] != b[i]) return false; } return true; } }