Java Arrays equals方法针对byte


Java Arrays equals方法针对byte

package com.codingdict;

import java.util.Arrays;

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

      // initializing three byte arrays
      byte[] arr1 = new byte[] { 12, 31, 22 , 44 };
      byte[] arr2 = new byte[] { 12, 31, 22 , 44 };
      byte[] arr3 = new byte[] { 31, 44, 12 , 22 };

      // 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)
   }
}