Here you can find the source of areEqual(byte[] a, byte[] b)
Returns true
if the two designated byte arrays are (a) non-null, (b) of the same length, and (c) contain the same values.
Parameter | Description |
---|---|
a | the first byte array. |
b | the second byte array. |
true
if the two designated arrays contain the same values. Returns false
otherwise.
public static boolean areEqual(byte[] a, byte[] b)
//package com.java2s; // under the terms of the GNU General Public License as published by the Free public class Main { /**//from w w w. j av a2 s. c o m * <p>Returns <code>true</code> if the two designated byte arrays are * (a) non-null, (b) of the same length, and (c) contain the same values.</p> * * @param a the first byte array. * @param b the second byte array. * @return <code>true</code> if the two designated arrays contain the same * values. Returns <code>false</code> otherwise. */ public static boolean areEqual(byte[] a, byte[] b) { if (a == null || b == null) { return false; } int aLength = a.length; if (aLength != b.length) { return false; } for (int i = 0; i < aLength; i++) { if (a[i] != b[i]) { return false; } } return true; } }