Checks whether a byte array just contains elements equal to zero
@param  bytes input byte array
@return true if all bytes of the array are 0
555796
public static boolean isZero(byte[] bytes) {
		int x = 0;
		for (int i = 0; i < bytes.length; i++) {
			x |= bytes[i];
		}
		return x == 0;
	}
1268869
@Override
  public boolean containsKey(Object o) {
    @SuppressWarnings("unchecked")
    final K key = (K) o;
    return binarySearchInArray(key) >= 0 || overflowEntries.containsKey(key);
  }
294204
public static int parseInt(byte[] bytes) {
        int result = 0;
        for (byte aByte : bytes) {
            if (aByte == ' ') return result;

            result *= 10;
            result += (aByte - (byte) '0');
        }

        return result;
    }
623449
protected boolean containsEOLDelimiters(byte[] data) {
        int numCRLFs = 0;
        for (int i = 0; i < data.length; i++) {
            if ('\r' == data[i] || '\n' == data[i]) {
                numCRLFs++;
                if (4 == numCRLFs) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "contains 4 consecutive CRs and/or LFs: true");
                    }
                    return true;
                }
                if ((i > 0) && ('\n' == data[i])) {
                    if ('\n' == data[i - 1]) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "contains LF-LF: true");
                        }
                        return true;
                    }
                }
            } else {
                // must be in a row, reset counter
                numCRLFs = 0;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "containsEOLDelimiters: false count=" + numCRLFs);
        }
        return false;
    }
381665
private boolean subArraysEqual(byte[] a, int aStart, byte[] b, int bStart, int len) {
        for (int i = aStart, j = bStart; len > 0; i++, j++, len--) {
            if (a[i] != b[j]) {
                return false;
            }
        }

        return true;
    }
46761
public void setByteLimit(int bytes)
    {
        _byteLimit=bytes;
        
        if (bytes>=0)
        {
            _newByteLimit=true;
            _byteLimit-=_contents-_pos;
            if (_byteLimit<0)
            {
                _avail+=_byteLimit;
                _byteLimit=0;
            }
        }
        else
        {
            _newByteLimit=false;
            _avail=_contents;
            _eof=false;
        }
    }
1259043
public static boolean contains(ByteBuffer buf, int position, short x, final int numRuns) {
    int index = bufferedUnsignedInterleavedBinarySearch(buf, position, 0, numRuns, x);
    if (index >= 0) {
      return true;
    }
    index = -index - 2; // points to preceding value, possibly -1
    if (index != -1) {// possible match
      int offset = toIntUnsigned(x)
          - toIntUnsigned(buf.getShort(position + index * 2 * 2));
      int le = toIntUnsigned(buf.getShort(position + index * 2 * 2 + 2));
      if (offset <= le) {
        return true;
      }
    }
    return false;

  }
67184
public ContentInfo findMatch(byte[] bytes) {
		if (bytes.length == 0) {
			return ContentInfo.EMPTY_INFO;
		} else {
			return magicEntries.findMatch(bytes);
		}
	}
534140
public static byte[] trim(final byte[] bytes) {
    for (int i = 0; i < bytes.length; i++) {
      if (bytes[i] != 0) {
        return Arrays.copyOfRange(bytes, i, bytes.length);
      }
    }
    return new byte[]{};
  }
604537
private static byte[] checkIllegalCharacters(final byte[] bytes) {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        for (final byte byt: bytes) {
            if (BASE64CHARS.indexOf(byt) < 0) {
                out.write(byt);
            }
        }
        return out.toByteArray();
    }
691709
private static boolean constantTimeEquals(byte[] a, byte[] b) {
    if (a.length != b.length) {
      return false;
    }

    int result = 0;
    for (int i = 0; i < a.length; i++) {
      result |= a[i] ^ b[i];
    }
    return result == 0;
  }
624749
public boolean isSet(int bit) {
    int bite = byteForBit(bit);
    if (bite >= bits.length || bits.length == 0) {
      return false;
    }
    int bitOnByte = bitOnByte(bit, bite);
    return ((1 << bitOnByte) & bits[bite]) != 0;
  }
354578
private boolean lessThanOrEqual(
         byte[] a,
         byte[] b)
    {
         if (a.length <= b.length)
         {
             for (int i = 0; i != a.length; i++)
             {
                 int    l = a[i] & 0xff;
                 int    r = b[i] & 0xff;

                 if (r > l)
                 {
                     return true;
                 }
                 else if (l > r)
                 {
                     return false;
                 }
             }

             return true;
         }
         else
         {
             for (int i = 0; i != b.length; i++)
             {
                 int    l = a[i] & 0xff;
                 int    r = b[i] & 0xff;

                 if (r > l)
                 {
                     return true;
                 }
                 else if (l > r)
                 {
                     return false;
                 }
             }

             return false;
         }
    }
1232442
static boolean arraysEqual(byte[] array1, byte[] array2) {
    if (array1.length != array2.length) {
      return false;
    }
    
    boolean isEqual = true;
    for (int i = 0; i < array1.length; i++) {
      if (array1[i] != array2[i]) {
        isEqual = false;
      }
    }
    return isEqual;
  }
947063
public static byte[] readAll(InputStream bytes) throws IOException {
    ByteArrayOutputStream builder = new ByteArrayOutputStream();
    int read = bytes.read();
    while (read != -1) {
      builder.write(read);
      read = bytes.read();
    }
    builder.flush();
    bytes.close();
    return builder.toByteArray();
  }
138079
public static boolean isZero(long[] v) {
    for(int i = 0; i < v.length; i++) {
      if(v[i] != 0) {
        return false;
      }
    }
    return true;
  }
313675
private void checkSubArray(byte[] test, byte[] data, int offset) {
    Preconditions.checkArgument(data.length >= test.length + offset);
    for (int i = 0; i < test.length; i++) {
      Preconditions.checkArgument(test[i] == data[i + offset]);
    }
  }