Java Byte Array Equal byteArrayEquals(final byte[] actual, final byte[] expected)

Here you can find the source of byteArrayEquals(final byte[] actual, final byte[] expected)

Description

byte Array Equals

License

Open Source License

Declaration

public static final boolean byteArrayEquals(final byte[] actual, final byte[] expected) 

Method Source Code

//package com.java2s;
/**/*www  .j  a  v a  2s  .  c  o m*/
 * Copyright (C) 2014 Bnome SPRL (info@bnome.be)
 *
 * This file is part of VectionVR Stabilizer library.
 *
 * VectionVR Stabilizer library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VectionVR Stabilizer library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VectionVR Stabilizer library.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static final boolean byteArrayEquals(final byte[] actual, final byte[] expected) {
        if (actual != null && expected != null && actual.length == expected.length) {
            for (int index = 0; index < actual.length; ++index) {
                if (actual[index] != expected[index]) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
}

Related

  1. byteArrayEquals(byte[] a1, byte[] a2)
  2. byteArrayEquals(byte[] b1, byte[] b2)
  3. byteArrayEquals(final byte[] lhs, final byte[] rhs)
  4. byteArraysEqual(byte[] b1, byte[] b2)
  5. bytesEqual(byte[] a, byte[] b)
  6. bytesEqual(byte[] a, byte[] b, int len)