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 the number of array dimensions supported by the
implementation (typically 255).
Returns:
the new array
Parameters:
- componentType - the Class
object representing the component
type of the new array
- dimensions - an array of int
representing the dimensions of
the new array
Throws:
- NullPointerException - if the specified
componentType
argument is null
- IllegalArgumentException - if the specified dimensions
argument is a zero-dimensional array, or if the number of
requested dimensions exceeds the limit on the number of array dimensions
supported by the implementation (typically 255), or if componentType
is {@link Void#TYPE}.
- NegativeArraySizeException - if any of the components in
the specified dimensions
argument is negative.