Byte Array Compare - Android File Input Output

Android examples for File Input Output:Byte Array

Description

Byte Array Compare

Demo Code


//package com.book2s;

public class Main {
    public static boolean ByteArrayCompare(byte[] a1, byte[] a2) {
        if (a1 == null || a2 == null || a1.length == 0 || a2.length == 0) {
            return false;
        }//from   w w w  .j  a v  a  2s.co m
        if (a1.length != a2.length) {
            return false;
        }
        for (int index = 0; index < a1.length; index++) {
            if (a1[index] != a2[index]) {
                return false;
            }
        }

        return true;
    }
}

Related Tutorials