{@inheritDoc} Note that this implementation accepts negative valued
indices.
435078
@SuppressWarnings("unchecked")
    public V get(int index) {
	int pos = Arrays.binarySearch(keyIndices, index);
	return (pos >= 0) ? (V)(values[pos]) : null;	
    }
768537
int indexOf(byte[] data, int dataLength, byte[] pattern, int dataOffset) {
        int[] failure = computeFailure(pattern);
        int j = 0;
        if (data.length == 0)
            return -1;
        //final int dataLength = data.length;
        final int patternLength = pattern.length;
        for (int i = dataOffset; i < dataLength; i++) {
            while (j > 0 && pattern[j] != data[i])
                j = failure[j - 1];
            if (pattern[j] == data[i])
                j++;
            if (j == patternLength)
                return i - patternLength + 1;
        }
        return -1;
    }
682972
public Element put(int index, Element newValue) {

		Element oldValue = null;

        int size = list.size();

		if (index < 0) {
            if (index < -size) {
                // negative indices do not auto-prepend
                // (asopposed to positive ones that grow the list by appending undef)
                throw new EvaluationException(MessageUtils.format(
                    MSG_INVALID_NEGATIVE_LIST_INDEX, Integer.toString(index), size));
            } else {
                index += size;
            }
		}

		try {
			if ((newValue != null) && !(newValue instanceof Null)) {
				if (index >= size) {
					for (int i = 0; i < index - size; i++) {
						list.add(Undef.VALUE);
					}
					list.add(newValue);
				} else {
					oldValue = list.set(index, newValue);
					if (oldValue != null) {
						oldValue.checkValidReplacement(newValue);
					}
				}
			} else {
				try {
					oldValue = list.remove(index);
				} catch (IndexOutOfBoundsException ioobe) {
					// Ignore this error; removing non-existant element is OK.
				}
			}
		} catch (IndexOutOfBoundsException ioobe) {
			throw new EvaluationException(MessageUtils.format(
					MSG_NONEXISTANT_LIST_ELEMENT, Integer.toString(index)));
		}
		return oldValue;
	}
1144718
def neg_int(i):
    
    try:
        if isinstance(i, string_types):
            i = int(i)
        if not isinstance(i, int) or i > 0:
            raise Exception()
    except:
        raise ValueError("Not a negative integer")
    return i
465863
@Pure
	@Inline(value = "(-($1.longValue()))", constantExpression = true)
	public static long operator_minus(AtomicLong number) {
		return -number.longValue();
	}
92904
@CheckReturnValue
  public UnsignedInteger minus(UnsignedInteger val) {
    return fromIntBits(value - checkNotNull(val).value);
  }
1309525
public long getUnsignedIntAt(int index) {
        _checkForReadAt(index,4);
        long val = (long) (_buf.getInt(index) & 0xffffffffL);
        return val;
    }
180053
public static <T> int indexOf(T[] array, T value) {
        for (int i = 0; i < array.length; i++) {
            if (array[i] == null) {
                if (value == null) return i;
            } else {
                if (value != null && array[i].equals(value)) return i;
            }
        }
        return -1;
    }
1207003
private final int scan_negative_for_numeric_type(int c) throws IOException
    {
        assert(c == '-');
        c = read_char();
        int t = scan_for_numeric_type(c);
        if (t == IonTokenConstsX.TOKEN_TIMESTAMP) {
            bad_token(c);
        }
        unread_char(c); // and the caller need to unread the '-'
        return t;
    }
382191
private static Object get(Object object, int index) {
        if (index < 0) {
            throw new IndexOutOfBoundsException("Index cannot be negative: "
                    + index);
        }
        if (object instanceof Map) {
            Map<?, ?> map = (Map<?, ?>) object;
            Iterator<?> iterator = map.entrySet().iterator();
            return get(iterator, index);
        } else if (object instanceof List) {
            return ((List<?>) object).get(index);
        } else if (object instanceof Object[]) {
            return ((Object[]) object)[index];
        } else if (object instanceof Iterator) {
            Iterator<?> it = (Iterator<?>) object;
            while (it.hasNext()) {
                index--;
                if (index == -1) {
                    return it.next();
                } else {
                    it.next();
                }
            }
            throw new IndexOutOfBoundsException("Entry does not exist: "
                    + index);
        } else if (object instanceof Collection) {
            Iterator<?> iterator = ((Collection<?>) object).iterator();
            return get(iterator, index);
        } else if (object instanceof Enumeration) {
            Enumeration<?> it = (Enumeration<?>) object;
            while (it.hasMoreElements()) {
                index--;
                if (index == -1) {
                    return it.nextElement();
                } else {
                    it.nextElement();
                }
            }
            throw new IndexOutOfBoundsException("Entry does not exist: "
                    + index);
        } else if (object == null) {
            throw new IllegalArgumentException("Unsupported object type: null");
        } else {
            try {
                return Array.get(object, index);
            } catch (IllegalArgumentException ex) {
                throw new IllegalArgumentException("Unsupported object type: "
                        + object.getClass().getName());
            }
        }
    }
1346493
private void writeInteger(int value)
		throws IOException
	{
		if(value < 0)
		{
			out.write(TAG_NEGATIVE_INT);
			writeIntegerNoTag(-value);
		}
		else
		{
			out.write(TAG_POSITIVE_INT);
			writeIntegerNoTag(value);
		}
	}
527694
private void ensureIndex(final int index) {
        if (index < 0) throw new IndexOutOfBoundsException("Index (" + index + ") is negative");
        if (index > size())
            throw new IndexOutOfBoundsException("Index (" + index + ") is greater than list size (" + (size()) + ")");
    }
1094836
public void encodeNBitUnsignedInteger(int b, int n) throws IOException {
		if (b < 0 || n < 0) {
			throw new IllegalArgumentException(
					"Encode negative value as unsigned integer is invalid!");
		}
		assert (b >= 0);
		assert (n >= 0);

		ostream.writeBits(b, n);
	}
51561
public Vector4i negate(Vector4i dest) {
        dest.x = -x;
        dest.y = -y;
        dest.z = -z;
        dest.w = -w;
        return dest;
    }
479368
public function negative()
    {
        if (!is_int($this->value) && !is_float($this->value)) {
            throw new InvalidIntOrFloatException($this->name, $this->value);
        } elseif ($this->value >= 0) {
            throw new NumberNotNegativeException($this->name, $this->value);
        }

        return $this;
    }
736120
public int indexOf( byte value ) {
		for (int i = 0; i < size; i++) {
			if( data[i] == value )
				return i;
		}
		return -1;
	}
240251
public static void notNegative(Long value) {
		if(!validation) return;
		notNull(value);
		if(value < 0)
			throw new ParameterException(ErrorCode.NEGATIVE);
	}