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[] p, byte id)
A convenience function to determine whether the first non-zero byte is equal to a specific value.
if (null == p || 0 == p.length) {
    return false;
int start = 0;
for (start = 0; start < p.length && 0x00 == p[start]; start++)
    ;
if (p.length <= start) {
    return false;
...
booleanstartsWith(byte[] prefix, byte[] source)
returns whether the source array starts with the prefix array
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;
booleanstartsWith(byte[] source, byte[] match)
Does this byte array begin with match array content?
return startsWith(source, 0, match);
booleanstartsWith(byte[] source, byte[] match)
starts With
return startsWith(source, 0, match);
booleanstartsWith(byte[] source, int offset, byte[] match)
Does this byte array begin with match array content?
if (match.length > (source.length - offset)) {
    return false;
for (int i = 0; i < match.length; i++) {
    if (source[offset + i] != match[i]) {
        return false;
return true;
booleanstartsWith(byte[] target, byte[] search, int offset)
Check if a byte array starts with the given byte array.
final int targetLength = target.length;
final int searchLength = search.length;
if (offset < 0 || searchLength > targetLength + offset) {
    return false;
for (int i = 0; i < searchLength; i++) {
    if (target[i + offset] != search[i]) {
        return false;
...
booleanstartsWith(byte[] target, int offset, byte[] litmusPaper)
starts With
if ((target.length - offset) < litmusPaper.length) {
    return false;
for (int i = offset, j = 0; j < litmusPaper.length; i++, j++) {
    if (target[i] != litmusPaper[j]) {
        return false;
return true;
booleanstartsWith(char s[], int len, String prefix)
Returns true if the character array starts with the suffix.
final int prefixLen = prefix.length();
if (prefixLen > len)
    return false;
for (int i = 0; i < prefixLen; i++)
    if (s[i] != prefix.charAt(i))
        return false;
return true;
booleanstartsWith(char[] prefix, char[] other)
Find out if a char[] starts with a prefix
if (prefix.length != 0 && prefix.length <= other.length) {
    for (int i = 0; i < prefix.length; i++) {
        if (other[i] != prefix[i]) {
            return false;
    return true;
return false;
booleanstartsWith(char[] src, char[] find, int startAt)
Test whether 'find' can be found at position 'startPos' in the string 'src'.
int startPos = startAt;
boolean result = true;
if (src.length < startPos + find.length) {
    result = false;
} else {
    final int max = find.length;
    for (int a = 0; a < max && result; a++) {
        if (src[startPos] != find[a]) {
...