while(!args[checkloc].equals("EOD")) { System.out.println("something or other"); if (!args[checkloc].equals("EOD")) checkloc++; }