Here you can find the source of removeFlagsFromArgs(String[] args)
public static String[] removeFlagsFromArgs(String[] args)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static String[] removeFlagsFromArgs(String[] args) { List<String> ret = new ArrayList<String>(); boolean removeNextArg = false; for (String argument : args) { if (argument.equals("-a")) { removeNextArg = true;//from ww w. ja v a2 s .c om continue; } if (removeNextArg) { removeNextArg = false; continue; } ret.add(argument); } return ret.toArray(new String[0]); } }