public final int[] getArray(int[] array) {
        if (array == null || array.length != length()) {
            array = new int[length()];
        }

        for (int i = 0; i < length(); i++) {
            array[i] = get(i);
        }

        return array;
    }
public final int [ ] getArray ( int [ ] array ) { if ( array == null || array . length != length ( ) ) { array = new int [ length ( ) ] ; } for ( int i = 0 ; i < length ( ) ; i ++ ) { array [ i ] = get ( i ) ; } return array ; }
Gets an array containing all the values in the array. The returned values are not guaranteed to be from the same time instant.<br> If an array is provided and it is the correct length, then
that array will be used as the destination array.

@param array the provided array
@return an array containing the values in the array