Arrays.CopyOfRange Method

Definition

Overloads

CopyOfRange(Single[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Int64[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Int32[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Int16[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Object[], Int32, Int32, Class)

Copies the specified range of the specified array into a new array.

CopyOfRange(Char[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Byte[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Boolean[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Object[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Double[], Int32, Int32)

Copies the specified range of the specified array into a new array.

CopyOfRange(Single[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([FII)[F", "")]
public static float[] CopyOfRange (float[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([FII)[F", "")>]
static member CopyOfRange : single[] * int * int -> single[]

Parameters

original
Single[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Single[]

a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0f is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(float[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Int64[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([JII)[J", "")]
public static long[] CopyOfRange (long[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([JII)[J", "")>]
static member CopyOfRange : int64[] * int * int -> int64[]

Parameters

original
Int64[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Int64[]

a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0L is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(long[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Int32[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([III)[I", "")]
public static int[] CopyOfRange (int[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([III)[I", "")>]
static member CopyOfRange : int[] * int * int -> int[]

Parameters

original
Int32[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Int32[]

a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0 is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(int[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Int16[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([SII)[S", "")]
public static short[] CopyOfRange (short[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([SII)[S", "")>]
static member CopyOfRange : int16[] * int * int -> int16[]

Parameters

original
Int16[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Int16[]

a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case (short)0 is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(short[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Object[], Int32, Int32, Class)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([Ljava/lang/Object;IILjava/lang/Class;)[Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "U" })]
public static Java.Lang.Object[] CopyOfRange (Java.Lang.Object[] original, int from, int to, Java.Lang.Class newType);
[<Android.Runtime.Register("copyOfRange", "([Ljava/lang/Object;IILjava/lang/Class;)[Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "U" })>]
static member CopyOfRange : Java.Lang.Object[] * int * int * Java.Lang.Class -> Java.Lang.Object[]

Parameters

original
Object[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

newType
Class

the class of the copy to be returned

Returns

Object[]

a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length

Attributes

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from. The resulting array is of the class newType.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(U[], int, int, java.lang.Class<? extends T[]>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Char[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([CII)[C", "")]
public static char[] CopyOfRange (char[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([CII)[C", "")>]
static member CopyOfRange : char[] * int * int -> char[]

Parameters

original
Char[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Char[]

a new array containing the specified range from the original array, truncated or padded with null characters to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case '\u005cu0000' is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(char[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Byte[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([BII)[B", "")]
public static byte[] CopyOfRange (byte[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([BII)[B", "")>]
static member CopyOfRange : byte[] * int * int -> byte[]

Parameters

original
Byte[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Byte[]

a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case (byte)0 is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(byte[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Boolean[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([ZII)[Z", "")]
public static bool[] CopyOfRange (bool[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([ZII)[Z", "")>]
static member CopyOfRange : bool[] * int * int -> bool[]

Parameters

original
Boolean[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

a new array containing the specified range from the original array, truncated or padded with false elements to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case false is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(boolean[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Object[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([Ljava/lang/Object;II)[Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object[] CopyOfRange (Java.Lang.Object[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([Ljava/lang/Object;II)[Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member CopyOfRange : Java.Lang.Object[] * int * int -> Java.Lang.Object[]

Parameters

original
Object[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Object[]

a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length

Attributes

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

The resulting array is of exactly the same class as the original array.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(T[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOfRange(Double[], Int32, Int32)

Copies the specified range of the specified array into a new array.

[Android.Runtime.Register("copyOfRange", "([DII)[D", "")]
public static double[] CopyOfRange (double[] original, int from, int to);
[<Android.Runtime.Register("copyOfRange", "([DII)[D", "")>]
static member CopyOfRange : double[] * int * int -> double[]

Parameters

original
Double[]

the array from which a range is to be copied

from
Int32

the initial index of the range to be copied, inclusive

to
Int32

the final index of the range to be copied, exclusive. (This index may lie outside the array.)

Returns

Double[]

a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length

Attributes

Exceptions

if start original.length

if start > end

if original == null

Remarks

Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0d is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.

Added in 1.6.

Java documentation for java.util.Arrays.copyOfRange(double[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to