Step 1: First you need a rooted device for the same,
for this: you can follow this link: How rooting is achieved programmatically?
Step 2:
You cannot do a reboot from an ordinary SDK application. Only applications signed with the system firmware signing key can do this.
Programmatically switching off Android phone
you can also try this code for rrotes device.
public void restart(int delay) {
PendingIntent intent = PendingIntent.getActivity(this.getBaseContext(), 0, new Intent(getIntent()), getIntent().getFlags());
AlarmManager manager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
manager.set(AlarmManager.RTC, System.currentTimeMillis() + delay, intent);
System.exit(2);
}