Here you can find the source of arraysEquals(byte[] a, byte[] b)
public static boolean arraysEquals(byte[] a, byte[] b)
//package com.java2s; /*//from w w w. j av a 2s . co m TruPax Copyright (C) 2015 CODERSLAGOON TruPax 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. TruPax 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 TruPax. If not, see http://www.gnu.org/licenses/. */ public class Main { public static boolean arraysEquals(byte[] a, byte[] b) { if (a.length != b.length) { return false; } return arraysEquals(a, 0, b, 0, a.length); } public static boolean arraysEquals(byte[] a, int ofsA, byte[] b, int ofsB, int len) { int end = ofsA + len; while (ofsA < end) { if (b[ofsB++] != a[ofsA++]) { return false; } } return true; } public static boolean arraysEquals(char[] a, char[] b) { if (a.length != b.length) { return false; } return arraysEquals(a, 0, b, 0, a.length); } public static boolean arraysEquals(char[] a, int ofsA, char[] b, int ofsB, int len) { int end = ofsA + len; while (ofsA < end) { if (b[ofsB++] != a[ofsA++]) { return false; } } return true; } public static boolean arraysEquals(int[] a, int[] b) { if (a.length != b.length) { return false; } return arraysEquals(a, 0, b, 0, a.length); } public static boolean arraysEquals(int[] a, int ofsA, int[] b, int ofsB, int len) { int end = ofsA + len; while (ofsA < end) { if (b[ofsB++] != a[ofsA++]) { return false; } } return true; } }