The isEqual() method of java.security.MessageDigest class is used to test if two message digest are equal or not.
public static boolean isEqual(byte digesta, byte digestb)
Paramters: This method takes 2 byte arrays for comparison.
Return Value: This method provides the Boolean value, true if both digests are equal otherwise false.
Below are the examples to illustrate the isEqual() method:
Example 1: For Equal Digest Values
msd1 is equals to msd2
Example 2: For Unequal Digest Values
msd1 is not equals to msd2
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.