Android Array Equal areEqual(byte[] a, byte[] b)

Here you can find the source of areEqual(byte[] a, byte[] b)

Description

are Equal

License

Open Source License

Declaration

public static boolean areEqual(byte[] a, byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean areEqual(boolean[] a, boolean[] b) {
        if (a == b) {
            return true;
        }//from   w w w  .  jav a2 s. c  o m

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(byte[] a, byte[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }

    public static boolean areEqual(int[] a, int[] b) {
        if (a == b) {
            return true;
        }

        if (a == null || b == null) {
            return false;
        }

        if (a.length != b.length) {
            return false;
        }

        for (int i = 0; i != a.length; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }

        return true;
    }
}

Related

  1. areEqual(boolean[] a, boolean[] b)
  2. areEqual(int[] a, int[] b)
  3. equals(byte[] array1, byte[] array2, int length)