Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/lang/reflect/Array#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/lang/reflect/Array#inhmethods)

# Array

` public final class Array `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.lang.reflect.Array |

<br />

*** ** * ** ***

The `Array` class provides static methods to dynamically create and access Java arrays.

`Array` permits widening conversions to occur during a get or set operation, but throws an `IllegalArgumentException` if a narrowing conversion would occur.

## Summary

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object. |
| ` static boolean` | ` https://developer.android.com/reference/java/lang/reflect/Array#getBoolean(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `boolean`. |
| ` static byte` | ` https://developer.android.com/reference/java/lang/reflect/Array#getByte(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `byte`. |
| ` static char` | ` https://developer.android.com/reference/java/lang/reflect/Array#getChar(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `char`. |
| ` static double` | ` https://developer.android.com/reference/java/lang/reflect/Array#getDouble(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `double`. |
| ` static float` | ` https://developer.android.com/reference/java/lang/reflect/Array#getFloat(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `float`. |
| ` static int` | ` https://developer.android.com/reference/java/lang/reflect/Array#getInt(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as an `int`. |
| ` static int` | ` https://developer.android.com/reference/java/lang/reflect/Array#getLength(java.lang.Object)(https://developer.android.com/reference/java/lang/Object array) ` Returns the length of the specified array object, as an `int`. |
| ` static long` | ` https://developer.android.com/reference/java/lang/reflect/Array#getLong(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `long`. |
| ` static short` | ` https://developer.android.com/reference/java/lang/reflect/Array#getShort(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object array, int index) ` Returns the value of the indexed component in the specified array object, as a `short`. |
| ` static https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/reflect/Array#newInstance(java.lang.Class<?>,%20int)(https://developer.android.com/reference/java/lang/Class<?> componentType, int length) ` Creates a new array with the specified component type and length. |
| ` static https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/reflect/Array#newInstance(java.lang.Class<?>,%20int[])(https://developer.android.com/reference/java/lang/Class<?> componentType, int... dimensions) ` Creates a new array with the specified component type and dimensions. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)(https://developer.android.com/reference/java/lang/Object array, int index, https://developer.android.com/reference/java/lang/Object value) ` Sets the value of the indexed component of the specified array object to the specified new value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setBoolean(java.lang.Object,%20int,%20boolean)(https://developer.android.com/reference/java/lang/Object array, int index, boolean z) ` Sets the value of the indexed component of the specified array object to the specified `boolean` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setByte(java.lang.Object,%20int,%20byte)(https://developer.android.com/reference/java/lang/Object array, int index, byte b) ` Sets the value of the indexed component of the specified array object to the specified `byte` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setChar(java.lang.Object,%20int,%20char)(https://developer.android.com/reference/java/lang/Object array, int index, char c) ` Sets the value of the indexed component of the specified array object to the specified `char` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setDouble(java.lang.Object,%20int,%20double)(https://developer.android.com/reference/java/lang/Object array, int index, double d) ` Sets the value of the indexed component of the specified array object to the specified `double` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setFloat(java.lang.Object,%20int,%20float)(https://developer.android.com/reference/java/lang/Object array, int index, float f) ` Sets the value of the indexed component of the specified array object to the specified `float` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setInt(java.lang.Object,%20int,%20int)(https://developer.android.com/reference/java/lang/Object array, int index, int i) ` Sets the value of the indexed component of the specified array object to the specified `int` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setLong(java.lang.Object,%20int,%20long)(https://developer.android.com/reference/java/lang/Object array, int index, long l) ` Sets the value of the indexed component of the specified array object to the specified `long` value. |
| ` static void` | ` https://developer.android.com/reference/java/lang/reflect/Array#setShort(java.lang.Object,%20int,%20short)(https://developer.android.com/reference/java/lang/Object array, int index, short s) ` Sets the value of the indexed component of the specified array object to the specified `short` value. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Object get (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object. The value is automatically wrapped in an object if it has a primitive type.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | the (possibly wrapped) value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

### getBoolean

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean getBoolean (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `boolean`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `boolean` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getByte

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static byte getByte (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `byte`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `byte` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getChar

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static char getChar (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `char`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `char` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getDouble

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static double getDouble (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `double`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `double` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getFloat

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float getFloat (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `float`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `float` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getInt

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getInt (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as an `int`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `int` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getLength

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getLength (Object array)
```

Returns the length of the specified array object, as an `int`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |

| Returns ||
|---|---|
| `int` | the length of the array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the object argument is not an array |

### getLong

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long getLong (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `long`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `long` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### getShort

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static short getShort (Object array, 
                int index)
```

Returns the value of the indexed component in the specified array object, as a `short`.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index <br /> |

| Returns ||
|---|---|
| `short` | the value of the indexed component in the specified array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#get(java.lang.Object,%20int)`

### newInstance

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Object newInstance (Class<?> componentType, 
                int length)
```

Creates a new array with the specified component type and length. Invoking this method is equivalent to creating an array as follows:
>
> ```
> int[] x = {length};
> Array.newInstance(componentType, x);
> ```

The number of dimensions of the new array must not exceed 255.

<br />

| Parameters ||
|---|---|
| `componentType` | `Class`: the `Class` object representing the component type of the new array <br /> |
| `length` | `int`: the length of the new array <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | the new array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if componentType is `https://developer.android.com/reference/java/lang/Void#TYPE` or if the number of dimensions of the requested array instance exceed 255. |
| `https://developer.android.com/reference/java/lang/NegativeArraySizeException` | if the specified `length` is negative |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the specified `componentType` parameter is null |

### newInstance

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Object newInstance (Class<?> componentType, 
                int... dimensions)
```

Creates a new array with the specified component type and dimensions. If `componentType` represents a non-array class or interface, the new array has `dimensions.length` dimensions and `componentType` as its component type. If `componentType` represents an array class, the number of dimensions of the new array is equal to the sum of `dimensions.length` and the number of dimensions of `componentType`. In this case, the component type of the new array is the component type of `componentType`.

The number of dimensions of the new array must not exceed 255.

<br />

| Parameters ||
|---|---|
| `componentType` | `Class`: the `Class` object representing the component type of the new array <br /> |
| `dimensions` | `int`: an array of `int` representing the dimensions of the new array <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | the new array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the specified `dimensions` argument is a zero-dimensional array, if componentType is `https://developer.android.com/reference/java/lang/Void#TYPE`, or if the number of dimensions of the requested array instance exceed 255. |
| `https://developer.android.com/reference/java/lang/NegativeArraySizeException` | if any of the components in the specified `dimensions` argument is negative. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the specified `componentType` argument is null |

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void set (Object array, 
                int index, 
                Object value)
```

Sets the value of the indexed component of the specified array object to the specified new value. The new value is first automatically unwrapped if the array has a primitive component type.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `value` | `Object`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the array component type is primitive and an unwrapping conversion fails |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

### setBoolean

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setBoolean (Object array, 
                int index, 
                boolean z)
```

Sets the value of the indexed component of the specified array object to the specified `boolean` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `z` | `boolean`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setByte

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setByte (Object array, 
                int index, 
                byte b)
```

Sets the value of the indexed component of the specified array object to the specified `byte` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `b` | `byte`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setChar

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setChar (Object array, 
                int index, 
                char c)
```

Sets the value of the indexed component of the specified array object to the specified `char` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `c` | `char`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setDouble

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setDouble (Object array, 
                int index, 
                double d)
```

Sets the value of the indexed component of the specified array object to the specified `double` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `d` | `double`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setFloat

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setFloat (Object array, 
                int index, 
                float f)
```

Sets the value of the indexed component of the specified array object to the specified `float` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `f` | `float`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setInt

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setInt (Object array, 
                int index, 
                int i)
```

Sets the value of the indexed component of the specified array object to the specified `int` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `i` | `int`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setLong

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setLong (Object array, 
                int index, 
                long l)
```

Sets the value of the indexed component of the specified array object to the specified `long` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `l` | `long`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`

### setShort

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setShort (Object array, 
                int index, 
                short s)
```

Sets the value of the indexed component of the specified array object to the specified `short` value.

<br />

| Parameters ||
|---|---|
| `array` | `Object`: the array <br /> |
| `index` | `int`: the index into the array <br /> |
| `s` | `short`: the new value of the indexed component <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified `index` argument is negative, or if it is greater than or equal to the length of the specified array |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified object argument is not an array, or if the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening conversion |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the specified object argument is null |

**See also:**

- `https://developer.android.com/reference/java/lang/reflect/Array#set(java.lang.Object,%20int,%20java.lang.Object)`