class ArrayWrappedIntIntMap {

  public void put(final int key, final int value) {
    Preconditions.checkArgument(key >= 0 && key <= MAX_KEY_VALUE,
        String.format("Index should be in range [0, %d], given [%d].", MAX_KEY_VALUE, key));
    Preconditions.checkArgument(value >= 0, String.format("Value must be non-negative, given [%d]", value));

    // resize the values array if the index falls beyond the current size of the array
    if (values.length < key + 1) {
      // Make the new size the next power of 2 number after the given index number
      int newValuesLength = Integer.highestOneBit(key) * 2;
      int[] newValues = Arrays.copyOf(values, newValuesLength);
      Arrays.fill(newValues, values.length, newValues.length - 1, Integer.MIN_VALUE);
      values = newValues;
    }

    values[key] = value;
  }

  public  ArrayWrappedIntIntMap();

}