Here is one of the best way to parse command line arguments in Java.
I have used apache common CLI library to parse command line arguments.
Github link for example code.
Click Here to see the list of alternative Java Cli processing libraries available.
Get glued to know more updates.
Have a nice day 🙂