Here you can find the source of byteArrayEquals(byte[] b1, byte[] b2)
public static boolean byteArrayEquals(byte[] b1, byte[] b2)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009 Zhao and others./* w w w . j a v a 2 s.com*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Zhao - initial API and implementation *******************************************************************************/ public class Main { public static boolean byteArrayEquals(byte[] b1, byte[] b2) { if (b1 != null && b2 != null && b1.length == b2.length) { for (int i = 0; i < b1.length; i++) { if (b1[i] != b2[i]) return false; } return true; } else { return false; } } }