Here you can find the source of equals(byte[] a1, byte[] a2)
static public boolean equals(byte[] a1, byte[] a2)
//package com.java2s; public class Main { static public boolean equals(byte[] a1, byte[] a2) { if ((a1 == null) || (a2 == null)) { return a1 == a2; }/*ww w .j av a 2 s .c o m*/ int nLength = a1.length; if (nLength != a2.length) { return false; } for (int i = 0; i < nLength; i++) { if (a1[i] != a2[i]) { return false; } } return true; } static public boolean equals(int[] a1, int[] a2) { if ((a1 == null) || (a2 == null)) { return a1 == a2; } int nLength = a1.length; if (nLength != a2.length) { return false; } for (int i = 0; i < nLength; i++) { if (a1[i] != a2[i]) { return false; } } return true; } }