How do I check the contact number and database number are same or not?

How do I check the contact list contact number and database number which has save are same or not?
I have successfully fetch all contact into my app from phone contact list also fetch from database.
how to compare two array.