Here you can find the source of startsWith(byte[] prefix, byte[] source)
Parameter | Description |
---|---|
prefix | the byte array containing the prefix |
source | the byte array of the source |
private static boolean startsWith(byte[] prefix, byte[] source)
//package com.java2s; //License from project: Open Source License public class Main { /** returns whether the source array starts with the prefix array * @param prefix the byte array containing the prefix * @param source the byte array of the source *//*from w ww . j ava 2s.c o m*/ private static boolean startsWith(byte[] prefix, byte[] source) { if (prefix.length > source.length) { return false; } else { for (int i = 0; i < prefix.length; i++) { if (prefix[i] != source[i]) { return false; } } return true; } } }