Here you can find the source of arrayStartsWith(byte[] array, byte[] target)
static boolean arrayStartsWith(byte[] array, byte[] target)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { /** Checks if array starts with target. */ static boolean arrayStartsWith(byte[] array, byte[] target) { if (array == null) { return false; }//from w ww.ja va2 s . com if (target == null) { return true; } if (target.length > array.length) { return false; } for (int i = 0; i < target.length; i++) { if (array[i] != target[i]) { return false; } } return true; } }