code: private static StartupInfo parseArguments(String args[]) {
      InstanceId instance = InstanceId.NODEZERO;
      StartupOption startOpt = StartupOption.REGULAR;
      boolean isStandby= false;
      String serviceName = null;
      boolean force = false;
      int argsLen = (args == null) ? 0 : args.length;
      for (int i=0; i < argsLen; i++) {
        String cmd = args[i];
        if (StartupOption.SERVICE.getName().equalsIgnoreCase(cmd)) {
          if (++i < argsLen) {
            serviceName = args[i];
          } else {
            return null;
          }
        } else if (StartupOption.STANDBY.getName().equalsIgnoreCase(cmd)) {
          isStandby = true;
        } else if (StartupOption.NODEZERO.getName().equalsIgnoreCase(cmd)) {
          instance = InstanceId.NODEZERO;
        } else if (StartupOption.NODEONE.getName().equalsIgnoreCase(cmd)) {
          instance = InstanceId.NODEONE;
        } else if (StartupOption.FORMAT.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.FORMAT;
        } else if (StartupOption.FORMATFORCE.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.FORMATFORCE;
        } else if (StartupOption.REGULAR.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.REGULAR;
        } else if (StartupOption.UPGRADE.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.UPGRADE;
        } else if (StartupOption.ROLLBACK.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.ROLLBACK;
        } else if (StartupOption.FINALIZE.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.FINALIZE;
        } else if (StartupOption.IMPORT.getName().equalsIgnoreCase(cmd)) {
          startOpt = StartupOption.IMPORT;
        } else if (StartupOption.FORCE.getName().equalsIgnoreCase(cmd)) {
          force = true;
        } else {
          return null;
        }
      }
      return new StartupInfo(startOpt, instance, isStandby, serviceName, force);
    }
docs: Analyze the command line options