Android Utililty Methods Array Sub Array

List of utility methods to do Array Sub Array

Description

The list of methods to do Array Sub Array are organized into topic(s).

Method

T[]subarray(T[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
boolean[]subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new boolean array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
byte[]subarray(byte[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new byte array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
char[]subarray(char[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new char array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
double[]subarray(double[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new double array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
float[]subarray(float[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new float array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
int[]subarray(int[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new int array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
long[]subarray(long[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new long array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
short[]subarray(short[] array, int startIndexInclusive, int endIndexExclusive)

Produces a new short array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive.

if (array == null) {
    return null;
if (startIndexInclusive < 0) {
    startIndexInclusive = 0;
if (endIndexExclusive > array.length) {
    endIndexExclusive = array.length;
...
byte[]subByteArray(byte[] array, int offset, int length)
sub Byte Array
int to = offset + length;
if (to > array.length)
    to = array.length;
return Arrays.copyOfRange(array, offset, to);