Here you can find the source of arrayStartsWith(byte[] a, byte[] b)
public static boolean arrayStartsWith(byte[] a, byte[] b)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean arrayStartsWith(byte[] a, byte[] b) { return rangeEquals(a, 0, b, 0, b.length); }// www . ja v a2 s. c o m public static boolean rangeEquals(byte[] a, int aStart, byte[] b, int bStart, int length) { assert a.length - aStart > length && b.length - bStart > length; for (int i = aStart, j = bStart, k = 0; k < length; k++) { if (a[i] != b[j]) return false; } return true; } }