Table of Content

Check if two Float Arrays are equal or not in Java


Declaration :

Explanation :

Purpose The java.util.Arrays.equals(float[] a float[] a2) method returns true if the two specified arrays of floats are equal to one another.Two arrays are equal if they contain the same elements in the same order.Two array references are considered equal if both are null.

Two floats f1 and f2 are considered equal if:
     new Float(f1).equals(new Float(f2))

Parameters a ===> This is the array to be tested for equality.
a2 ===> This is the other array to be tested for equality.
Return Value This method returns true if the two arrays are equal else false
Exception NA

Java Program : Example

Below example will explain java.util.Arrays.equals() method.

Output of Program :