I have a byte array with a ~known binary sequence in it. I need to confirm that the binary sequence is what it\'s supposed to be. I have tried .equals in additi
You can use both Arrays.equals() and MessageDigest.isEqual(). These two methods have some differences though.
MessageDigest.isEqual() is a time-constant comparison method and Arrays.equals() is non time-constant and it may bring some security issues if you use it in a security application.
The details for the difference can be read at Arrays.equals() vs MessageDigest.isEqual()