Howdy, Vijay! Welcome to JavaRanch!
The specs are not very clear about the magic cookie. For instance, it says that it identifies a data file as being valid, but it doesn't say what is the correct value. I myself assumed that the value that appears in the .db file that was sent to me was the right one. So, when I load the database records to the memory cache I have, I compare the value found in the provided .db file with the value of the .db file that was sent to me; if they don't match, then I throw an InvalidDatabaseException (which I created).
But I also saw some people that just ignored this value and assumed that the given .db file is valid, and passed without any problem.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD