Java Arrays equals方法针对float


Java Arrays equals方法针对float

package com.codingdict;

import java.util.Arrays;

public class ArrayDemo {
   public static void main(String[] args) {

      // initializing three float arrays
      float[] arr1 = new float[] { 1f, 123f };
      float[] arr2 = new float[] { 1f, 123f, 22f, 4f };
      float[] arr3 = new float[] { 1f, 123f };

      // comparing arr1 and arr2
      boolean retval = Arrays.equals(arr1, arr2);
      System.out.println("arr1 and arr2 equal: " + retval);

      // comparing arr1 and arr3
      boolean retval2 = Arrays.equals(arr1, arr3);
      System.out.println("arr1 and arr3 equal: " + retval2);
   }
}