Press the call button and type: *#7465625# (star, dash, seven, four, six, five, six, two, five, dash).
After you finish typing, you will see on the screen a menu that should say: “Network Lock (off)” = means that your phone is unlocked. Or “Network Lock (on)” = which means that the phone is network locked.
Another way to check this is to insert a SIM card from a different phone operator. For example, if you think that your phone is locked in the Vodafone network, you can insert a SIM card from Orange or AT&T.
If the phone is locked, you will have to enter the unlock code when you power up your phone with the wrong SIM card.
This should work for all the Samsung models.