Its a problem with comparing all strings this way...
Code:
if (args[i] == "-arg1")
== , when used with objects, compares the object pointers, ie - are they pointing to the same object. Use the equals() method instead.

Code:
if (args[i].equals("-arg1"))