Java Byte Array Equal bytesEqual(byte[] a, byte[] b, int len)

Here you can find the source of bytesEqual(byte[] a, byte[] b, int len)

Description

bytes Equal

License

Open Source License

Declaration

public static boolean bytesEqual(byte[] a, byte[] b, int len) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean bytesEqual(byte[] a, byte[] b, int len) {
        if (a == null && b == null)
            return true;
        if (a == null || b == null)
            return false;
        if (a.length < len || b.length < len)
            return false;

        for (int i = 0; i < len; i++)
            if (a[i] != b[i])
                return false;

        return true;
    }//ww w.  ja va2s. co m
}

Related

  1. byteArrayEquals(byte[] a1, byte[] a2)
  2. byteArrayEquals(byte[] b1, byte[] b2)
  3. byteArrayEquals(final byte[] actual, final byte[] expected)
  4. byteArrayEquals(final byte[] lhs, final byte[] rhs)
  5. bytesEqual(byte[] a, byte[] b)
  6. bytesEqual(byte[] a, int aFrom, int aLen, byte[] b, int bFrom, int bLen)
  7. bytesEqual(byte[] a, int aOff, byte[] b, int bOff, int len)
  8. bytesEqual(byte[] a1, byte[] a2)
  9. bytesEqual(byte[] a1, byte[] a2)