you can use the following code to exit the process
System.exit(1);
exit code can be any integer value

Thanks,
Nagendran A