Java Utililty Methods ArrayList to Array

List of utility methods to do ArrayList to Array

Description

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

Method

byte[]byteArrayListToByteArray(ArrayList indata)
byte Array List To Byte Array
byte[] temp = new byte[indata.size()];
for (int i = 0; i < temp.length; i++)
    temp[i] = (byte) indata.get(i).byteValue();
return temp;
StringbyteArrayListToCharToString(ArrayList byteArrayList)
byte Array List To Char To String
String resultString = null;
for (Byte byteToProcess : byteArrayList) {
    resultString += (char) (byteToProcess.byteValue());
return resultString;
StringconvertArrayListToHexString(ArrayList al)
convert Array List To Hex String
StringBuffer buf = new StringBuffer();
for (Byte b : al) {
    buf.append(String.format("%02X", b));
return buf.toString();
int[]convertArrayListToIntArray(ArrayList al)
convert Array List To Int Array
int[] list = new int[al.size()];
for (int i = 0; i < al.size(); i++)
    list[i] = al.get(i);
return list;
Long[]convertIntArrayList2array(ArrayList alInput)
A utility method to convert ArrayList to int[]
Long[] outputNodeIndices = new Long[alInput.size()];
int j = 0;
for (Iterator i = alInput.iterator(); i.hasNext(); j++) {
    outputNodeIndices[j] = ((Long) i.next()).longValue();
return (outputNodeIndices);
String[]convertStringArrayListToArray(ArrayList al)
convert String Array List To Array
String[] temp = al.toArray(new String[0]);
String[] list = new String[temp.length];
System.arraycopy(temp, 0, list, 0, temp.length);
return list;
double[]doubleArrayList2Array(ArrayList a)
double Array List Array
int num = a.size();
double[] result = new double[num];
for (int i = 0; i < num; i++)
    result[i] = ((Double) a.get(i)).doubleValue();
return result;
int[]listToArray(ArrayList tempList)
list To Array
if (tempList.size() == 0) {
    return null;
int[] tempArray = new int[tempList.size()];
for (int i = 0; i < tempList.size(); i++) {
    tempArray[i] = tempList.get(i);
return tempArray;
...
int[]listToIntArray(ArrayList list)
list To Int Array
int size = list.size();
int[] result = new int[size];
for (int i = 0; i < size; i++) {
    result[i] = ((Integer) list.get(i)).intValue();
return result;
String[]toArray(ArrayList arrayList)
to Array
return arrayListToStringArray(arrayList);