Utility function to parse a positive integer argument out of a String
array at the given index.
@param args String array containing element to find.
@param index Index of array element to parse integer from.
@return Integer parsed, or -1 if error.
340780
int getInt(String[] args, int index) {
    int result = -1;
    if(index >= 0 && index < args.length) {
      try {
        result = Integer.parseInt(args[index]);
      }catch(NumberFormatException e) {
        result = -1;
      }
    }
    return result;
  }
76291
public int locateIndex(int index) {

        int min = 0;
        int max = this.indexValues.length - 1;

        if (max == -1) {
            return -1;
        }

        // Binary search
        while ((this.indexValues[min] <= index) && (this.indexValues[max] >= index)) {
            int current = (max + min) / 2;
            if (this.indexValues[current] > index) {
                max = current - 1;
            } else if (this.indexValues[current] < index) {
                min = current + 1;
            } else {
                return current;
            }
        }
        if (this.indexValues[max] < index) {
            return max;
        } else {
            return min - 1;
        }
    }
1143902
private StringConstant parseStringConstant(int index)
    throws IOException
  {
    int stringIndex = readShort();

    return new StringConstant(_class.getConstantPool(), index, stringIndex);
  }
353986
@Override
  public Float remove(int index) {
    rangeCheck(index);
    float value = elements[index];
    for (int i = index + 1; i < size; i++) {
      elements[i - 1] = elements[i];
    }
    size -= 1;
    return value;
  }
555640
public MtasSpanQuery getPositiveQuery(int index) {
    if ((index >= 0) && (index < positiveQueryList.size())) {
      return positiveQueryList.get(index);
    } else {
      return null;
    }
  }
388315
private static boolean parseInputArgs(String[] args) {
    CommandLineParser parser = new DefaultParser();
    CommandLine cmd;
    try {
      cmd = parser.parse(OPTIONS, args);
    } catch (ParseException e) {
      System.out.println("Failed to parse input args: " + e);
      return false;
    }
    sHelp = cmd.hasOption("help");
    sType = OperationType.valueOf(cmd.getOptionValue("type", "READ"));
    sFileSize = FormatUtils.parseSpaceSize(cmd.getOptionValue("fileSize", "1KB"));
    sIterations = Integer.parseInt(cmd.getOptionValue("iterations", "1"));
    sConcurrency = Integer.parseInt(cmd.getOptionValue("concurrency", "1"));

    return true;
  }
1216024
public String convertIndexToString(int index)
    {
        String tempString = null;
        if ((index >= 0) && (index <= 9))
        {
            char value[] = new char[1];
            value[0] = (char)('0' + index);
            tempString = new String(value);         // 1 = '1'; 2 = '2'; etc...
        }
        else
            tempString = Constants.BLANK;
        return tempString;
    }
830746
private static int findIndex(String[] array, String target){
        for (int i = 0; i < array.length; i++) {
            if (target.equals(array[i])) {
                return i;
            }
        }
        return -1;
    }
618266
public String getString(int index)
  {
    Object value = _values[index - 1];

    if (value != null) {
      return value.toString();
    }
    else {
      return null;
    }
  }
1261
public static int checkArgPositive(final int arg, final String argNameOrErrorMsg) {
        if (arg <= 0) {
            if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) {
                throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be zero or negative: " + arg);
            } else {
                throw new IllegalArgumentException(argNameOrErrorMsg);
            }
        }

        return arg;
    }
836909
public int getEnd(int index) {
		if (this.endpos == null)
			throw new IllegalStateException("A result is not set.");
		if (index < 0 || this.nofgroups <= index)
			throw new IllegalArgumentException(
					"The parameter must be less than " + this.nofgroups + ": "
							+ index);
		return this.endpos[index];
	}
860174
static Object js_parseInt(Object[] args) {
        String s = ScriptRuntime.toString(args, 0);
        int radix = ScriptRuntime.toInt32(args, 1);

        int len = s.length();
        if (len == 0)
            return ScriptRuntime.NaNobj;

        boolean negative = false;
        int start = 0;
        char c;
        do {
            c = s.charAt(start);
            if (!ScriptRuntime.isStrWhiteSpaceChar(c))
                break;
            start++;
        } while (start < len);

        if (c == '+' || (negative = (c == '-')))
            start++;

        final int NO_RADIX = -1;
        if (radix == 0) {
            radix = NO_RADIX;
        } else if (radix < 2 || radix > 36) {
            return ScriptRuntime.NaNobj;
        } else if (radix == 16 && len - start > 1 && s.charAt(start) == '0') {
            c = s.charAt(start+1);
            if (c == 'x' || c == 'X')
                start += 2;
        }

        if (radix == NO_RADIX) {
            radix = 10;
            if (len - start > 1 && s.charAt(start) == '0') {
                c = s.charAt(start+1);
                if (c == 'x' || c == 'X') {
                    radix = 16;
                    start += 2;
                } else if ('0' <= c && c <= '9') {
                    radix = 8;
                    start++;
                }
            }
        }

        double d = ScriptRuntime.stringPrefixToNumber(s, start, radix);
        return ScriptRuntime.wrapNumber(negative ? -d : d);
    }
331982
public ProblemInput getProblemInput(final int index) {
		final List<ProblemInput> inputs = getProblemInputs();
		if (index < 0 || inputs.size() <= index) {
			throw new ArrayIndexOutOfBoundsException();
		}
		return inputs.get(index);
	}
1098434
public static int[] parseInts(String[] array) {
    int[] result = new int[array.length];
    for (int i = 0; i < array.length; i++)
      result[i] = Integer.parseInt(array[i]);
    return result;
  }
701416
public String convertIndexToString(int index)
    {
        String[][] rgstring = this.getPopupMap();
        if (index >= rgstring.length)
            index = 0;
        return rgstring[index][0];
    }
617829
@Override
    public int getInt(int index) {
        check(index);
        final FLValue flValue = values.get(index);
        return flValue != null ? (int) flValue.asInt() : 0;
    }
440927
public Object get (int index)
    {
        return _list[(_lastPos-index-1+_list.length)%_list.length];
    }