Here you can find the source of parseArgs(String[] args)
public static HashMap parseArgs(String[] args)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; public class Main { public static HashMap parseArgs(String[] args) { HashMap results = new HashMap(); for (int i = 0; i <= args.length - 1; i++) { String value = ""; if (args[i].indexOf("-") == 0) { if (args[i].length() == 2) { try { value = args[i + 1]; } catch (Exception e) { System.out.println("Unable to get value after flag '" + args[i] + "'"); }/*from w w w . j av a2s . c om*/ } else if (args[i].length() > 2) { value = args[i].substring(2); } else if (args[i].length() == 1) { System.out.println("Invalid flag"); } if (args[i].charAt(1) == 'p') { results.put("-p", value); } else if (args[i].charAt(1) == 'u') { results.put("-u", value); } } } return results; } }