Support the subscript operator with a collection for a long array

@param array a long array
@param indices a collection of indices for the items to retrieve
@return list of the longs at the given indices
@since 1.0
170672
@SuppressWarnings("unchecked")
    public static List<Long> getAt(long[] array, Collection indices) {
        return primitiveArrayGet(array, indices);
    }
295405
public static final long[] computeIndexOffsets(int[] sizes) {
    long[] indexOffsets = new long[sizes.length];
    for (int i = sizes.length - 1; i >= 0; i--) {
      if (i == sizes.length - 1) {
        indexOffsets[i] = 1;
      } else {
        indexOffsets[i] = indexOffsets[i + 1] * ((long) sizes[i + 1]);
      }
    }
    return indexOffsets;
  }
255744
@Override
    public INDArray get(INDArrayIndex... indexes) {

        sort();

        if (indexes.length == 1 && indexes[0] instanceof NDArrayIndexAll || (indexes.length == 2 && (isRowVector()
                        && indexes[0] instanceof PointIndex && indexes[0].offset() == 0
                        && indexes[1] instanceof NDArrayIndexAll
                        || isColumnVector() && indexes[1] instanceof PointIndex && indexes[0].offset() == 0
                                        && indexes[0] instanceof NDArrayIndexAll)))
            return this;

        throw new UnsupportedOperationException("Not implemented");
    }
168784
public static Object getIndex(Object array, int index)
            throws UtilTargetError {
        Interpreter.debug("getIndex: ", array, ", index=", index);
        try {
            if ( array instanceof List )
                return ((List<?>) array).get(index);
            Object val = Array.get(array, index);
            return Primitive.wrap( val, Types.arrayElementType(array.getClass()) );
        } catch( IndexOutOfBoundsException e1 ) {
            int len = array instanceof List
                    ? ((List<?>) array).size()
                    : Array.getLength(array);
            throw new UtilTargetError("Index " + index
                    + " out-of-bounds for length " + len, e1);
        }
    }
961911
public long getLong(int index)
  {
    Object value = _values[index - 1];

    if (value instanceof Long) {
      return (Long) value;
    }
    else if (value instanceof Integer) {
      return (Integer) value;
    }
    else {
      return Long.valueOf(value.toString());
    }
  }
464505
public static long[] toLongArray(Collection<Long> collection) {
        long[] collectionArray = new long[collection.size()];
        int index = 0;
        for (Long item : collection) {
            collectionArray[index++] = item;
        }
        return collectionArray;
    }
261112
private static long toArrayIndex(String id)
    {
        long index = toArrayIndex(ScriptRuntime.toNumber(id));
        // Assume that ScriptRuntime.toString(index) is the same
        // as java.lang.Long.toString(index) for long
        if (Long.toString(index).equals(id)) {
            return index;
        }
        return -1;
    }
631962
@Override
	public List<V> subList(final int fromIndex, final int toIndex) {
		return this.list.subList(fromIndex, toIndex);
	}
1112122
public static String getAt(CharSequence self, Collection indices) {
        StringBuilder answer = new StringBuilder();
        for (Object value : indices) {
            if (value instanceof Range) {
                answer.append(getAt(self, (Range) value));
            } else if (value instanceof Collection) {
                answer.append(getAt(self, (Collection) value));
            } else {
                int idx = DefaultTypeTransformation.intUnbox(value);
                answer.append(getAt(self, idx));
            }
        }
        return answer.toString();
    }
853002
public static double[] applyIndices (double[] vector, int[] indices) {
        // Initialize the return array:
        final double[] retval = new double[indices.length];

        // Iterate over indices and populate:
        for (int i = 0; i < retval.length; i++) {
            retval[i] = vector[indices[i]];
        }

        // Done, return the return value:
        return retval;
    }
1045701
public static long sum(long[] array) {
		if (array == null) {
			return 0L;
		}
		long sum = 0;
		for (int i = 0; i < array.length; i++) {
			sum += array[i];
		}
		return sum;
	}
308979
public Long getLong(int index) {
        Object number = list.get(index);
        if (number == null) return null;
        if (number instanceof Long) return (Long) number;
        if (number instanceof Double) return ((Double) number).longValue();
        throw new JsonException("not a long");
    }
460727
T get(long index) {
        checkRange(index);

        if (checkSubRange(index)) {
            // cannot exceed Integer.MAX_VALUE (checked by checkSubRange)
            return subList.get((int) (index - subListOffset));
        }
        return null;
    }
820140
public static long lArrayGet(long[] a, int i) {
        try {
            return a[i];
        } catch (Throwable t) {
            return a[DefaultGroovyMethodsSupport.normaliseIndex(i,a.length)];
        }
    }
1181385
public static short[] concatArrays(short[] array, short[]... arrays) {
        short[] res = array;
        for (short[] ele : arrays) {
            res = org.apache.commons.lang3.ArrayUtils.addAll(res, ele);
        }
        return res;
    }
57264
public static long[] parseLongs(String[] array) {
    long[] result = new long[array.length];
    for (int i = 0; i < array.length; i++)
      result[i] = Long.parseLong(array[i]);
    return result;
  }
1206962
public static List getAt(Matcher self, Collection indices) {
        List result = new ArrayList();
        for (Object value : indices) {
            if (value instanceof Range) {
                result.addAll(getAt(self, (Range) value));
            } else {
                int idx = DefaultTypeTransformation.intUnbox(value);
                result.add(getAt(self, idx));
            }
        }
        return result;
    }