Java Utililty Methods Array Starts With

List of utility methods to do Array Starts With

Description

The list of methods to do Array Starts With are organized into topic(s).

Method

booleanstartsWith(byte a[], int from, byte b[])
starts With
final int nb = b.length;
for (int i = 0; i < nb; i++) {
    final int j = from + i;
    if (j >= a.length || a[j] != b[i])
        return false;
return true;
booleanstartsWith(byte[] arr, int offset, int len, byte[] pattern)
starts With
int length = pattern.length;
int i;
if (len < length)
    return false;
for (i = 0; i < length; i++)
    if (arr[offset + i] != pattern[i])
        break;
return i == length;
...
booleanstartsWith(byte[] array, byte[] prefix)
Utility method to check if one byte array starts with a specified sequence of bytes.
if (array == prefix) {
    return true;
if (array == null || prefix == null) {
    return false;
int prefixLength = prefix.length;
if (prefix.length > array.length) {
...
booleanstartsWith(byte[] array, byte[] startBytes)
Determines whether the specified byte array starts with the specific bytes.
if (array == null || startBytes == null || array.length < startBytes.length) {
    return false;
for (int i = 0; i < startBytes.length; i++) {
    if (array[i] != startBytes[i]) {
        return false;
return true;
booleanstartsWith(byte[] bytes, int offset, byte... prefix)
starts With
if (length(bytes) == 0 || length(prefix) == 0 || prefix.length > bytes.length || offset < 0
        || offset + prefix.length > bytes.length) {
    return false;
for (int i = 0; i < prefix.length; i++) {
    if (prefix[i] != bytes[i + offset]) {
        return false;
return true;
booleanstartsWith(byte[] bytes, String str, int offset)
starts With
if (bytes.length < (offset + str.length()))
    return false;
for (int c = 0; c < str.length(); c++) {
    if (bytes[offset + c] != str.charAt(c))
        return false;
return true;
booleanstartsWith(byte[] bytes, String text)
starts With
char[] chars = text.toCharArray();
if (chars.length > bytes.length) {
    return false;
} else {
    for (int i = 0; i < chars.length; i++) {
        if (bytes[i] != chars[i]) {
            return false;
    return true;
booleanstartsWith(byte[] checkMe, byte[] maybePrefix)
starts With
int cm_len = checkMe.length;
int mp_len = maybePrefix.length;
if (cm_len < mp_len)
    return false;
for (int i = 0; i < mp_len; ++i)
    if (checkMe[i] != maybePrefix[i])
        return false;
return true;
...
booleanstartsWith(byte[] haystack, byte[] needle)
compare byte arrays
int i;
for (i = 0; i < needle.length; i++)
    if (needle[i] != haystack[i])
        break;
return i == needle.length;
booleanstartsWith(byte[] nameRaw, byte[] namePrefix)
starts With
for (int i = 0; i < namePrefix.length; i++) {
    if (namePrefix[i] != nameRaw[i])
        return false;
return true;