Compare Two Java byte Arrays - Java Language Basics

Java examples for Language Basics:byte

Description

Compare Two Java byte Arrays

Demo Code

import java.util.Arrays;
 
public class Main {
 
  public static void main(String[] args) {
    byte[] byteArray1 = new byte[]{7,2,1};
    byte[] byteArray2 = new byte[]{7,2,1};
   /*from   www  .  jav a2 s. com*/
    boolean blnResult = Arrays.equals(byteArray1,byteArray2);
    System.out.println("Are two byte arrays equal ? : " + blnResult);
  }
}

Result


Related Tutorials