This documentation is archived and is not being maintained.

Arrays.equals Method (SByte[ ], SByte[ ])

Visual Studio 2005

Checks if two byte arrays are equal.

Package: java.util

Assembly: vjslib (in vjslib.dll)


public static boolean equals(
    byte[] a1,
    byte[] a2);

Parameters

a1

The first array.

a2

The second array.

true if the two arrays are identical; false otherwise.

// Arr-equals-by.jsl 
// Arrays.equals example 
import java.util.*; 
public class MyClass 
{ 
public static void main() 
{ 
// Declare and initialize two arrays:
byte[] myArr1 = {2,1}; 
byte[] myArr2 = {1,2}; 
// Compare the arrays: 
boolean result = Arrays.equals(myArr1,myArr2); 
// Display the result: 
System.out.print("The result is: " + result); 
} 
} 
/* 
Output: 
The result is: false 
*/ 
Show: