Java Byte Array Compare allEquals(byte[] array, byte value, int offset, int maxLength)

Here you can find the source of allEquals(byte[] array, byte value, int offset, int maxLength)

Description

all Equals

License

MIT License

Declaration

public static boolean allEquals(byte[] array, byte value, int offset, int maxLength) 

Method Source Code

//package com.java2s;
/*/*from   w ww  . j  av a  2 s  .  c  o  m*/
 * Copyright (c) 2015. Troels Liebe Bentsen <tlb@nversion.dk>
 * Licensed under the MIT license (LICENSE.txt)
 */

public class Main {
    public static boolean allEquals(byte[] array, byte value, int offset, int maxLength) {
        maxLength = Math.min(offset + maxLength, array.length);
        for (int i = offset; i < maxLength; i++) {
            if (array[i] != value) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. ArrayByteCompare(byte[] a, byte[] b)
  2. bytesCmp(byte[] oi, byte[] oj)
  3. bytesCompare(byte[] a, byte[] b)
  4. bytesCompare(byte[] a, byte[] b)