Java Arrays.equals(float[] a, float[] a2)

Syntax

Arrays.equals(float[] a, float[] a2) has the following syntax.

public static boolean equals(float[] a,  float[] a2)

Example

In the following code shows how to use Arrays.equals(float[] a, float[] a2) method.


//  w  w w.  j  av  a2 s .  c o  m

import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
 
    float[] arr1 = new float[] { 1f, 123f };
    float[] arr2 = new float[] { 1f, 123f, 22f, 4f };
    float[] arr3 = new float[] { 1f, 123f };
    
    System.out.println(Arrays.equals(arr1, arr2));
    System.out.println(Arrays.equals(arr1, arr3));
  }
}

The code above generates the following result.