Im a master in this field
so follow my instructions:
1-you have to flash a cwm on your device so if you dont have it put off the battery then put it back if the phone starts automatically it means the power button is always pressed so just keep pressed the home button and the volume down button to enter in download mode.
Once in download mode connect your device to your pc using the usb cable.
Now follow a tutorial to flash the cwm using odin if you dont know how to do it.
2-once obtained the cmw put off the battery and then put it back and keep pressed the home button to enter in recovery mode. If u have the cwm there are no problems cuz now you just have to reboot your phone and save a rom in your sd card then go in recovery mode and flash it.
3-once you have a custom rom just download the android terminal emulator and type the following lines if you want to reboot your phone:
Press enter and allow superuser
Press enter to reboot your phone.
If you want to reboot in recovery mode typw this:
Press enter and your phone will reboot in recovery mode
If you dont want to use the terminal emulator just download an app from the play store called "reboot menu" and for lock/unlock your device use the notification power widget or apps like "proximity sensor screen off"
Sent from my GT-S5570 using xda premium