To format your phone memory you can download System tools application to the phone memory, then you have to make sure that your phone is fully charged or connected to the charger,then in system tools you can find option for formating the phone.
Before you do that make sure you made a backup of your contact list and messages because everything will go away after you format.
Or *#7370# into your phone.