Here you can find the source of bytesAreEqual(byte[] b1, byte[] b2)
true
if they're equal in length and content false
if they're not.
Parameter | Description |
---|---|
b1 | the first byte array. |
b2 | the second byte array. |
true
if the arrays are equal, false
if they are not.
public static boolean bytesAreEqual(byte[] b1, byte[] b2)
//package com.java2s; /*/* w w w . ja va2 s. c om*/ * $Id$ * * Copyright (c) 2008-2014 David Muller <roxon@users.sourceforge.net>. * All rights reserved. Use of the code is allowed under the * Artistic License 2.0 terms, as specified in the LICENSE file * distributed with this code, or available from * http://www.opensource.org/licenses/artistic-license-2.0.php */ import java.util.Arrays; public class Main { /** * Compares two byte arrays returning <code>true</code> if they're equal in * length and content <code>false</code> if they're not. * * @param b1 the first byte array. * @param b2 the second byte array. * * @return <code>true</code> if the arrays are equal, <code>false</code> if * they are not. */ public static boolean bytesAreEqual(byte[] b1, byte[] b2) { return Arrays.equals(b1, b2); } }