Java Utililty Methods Long Number Array Create

List of utility methods to do Long Number Array Create

Description

The list of methods to do Long Number Array Create are organized into topic(s).

Method

long[]toLongArray(final byte[] array)
to Long Array
return toLongArray(array, 0, array.length);
long[]toLongArray(final int[] in)
Convert integer array to long array
if (in == null)
    return null;
long[] out = new long[in.length];
for (int i = 0; i < in.length; i++) {
    out[i] = in[i];
return out;
Long[]toLongArray(final long[] longs)
Produces an array of Long objects from a long[].
final Long[] result = new Long[longs.length];
for (int i = 0; i < longs.length; i++) {
    result[i] = Long.valueOf(longs[i]);
return result;
long[]toLongArray(int... coordinates)
to Long Array
long[] result = new long[coordinates.length];
for (int i = coordinates.length; --i != -1;) {
    result[i] = coordinates[i];
return result;
long[]toLongArray(Number[] array)
Turns the Number array into one consisting of primitive longs.
long[] result;
int i;
result = new long[array.length];
for (i = 0; i < array.length; i++)
    result[i] = array[i].longValue();
return result;
long[]toLongArray(Object[] arr)
to Long Array
long[] arr2 = new long[arr.length];
for (int i = 0; i < arr.length; i++) {
    arr2[i] = Long.parseLong(String.valueOf(arr[i]));
return arr2;
long[]toLongArray(String array)
Cast a string to an array of longs

String should have the format "[1,2,3]".

if (array.length() == 2)
    return new long[0];
String[] cast = array.substring(1, array.length() - 1).split(",");
long[] result = new long[cast.length];
for (int i = 0; i < cast.length; i++) {
    result[i] = Long.valueOf(cast[i]);
return result;
...
long[]toLongArray(String str, String separator)
Converts a string of numbers to a long array
String[] fields = str.split(separator);
long[] tmp = new long[fields.length];
for (int i = 0; i < tmp.length; i++)
    tmp[i] = Long.parseLong(fields[i]);
return tmp;
long[]toLongArray(String[] anArray)
to Long Array
long[] output = new long[anArray.length];
for (int index = 0; index < anArray.length; index++)
    output[index] = Long.parseLong(anArray[index]);
return output;