Java ArrayList to Array toIntArray(ArrayList input)

Here you can find the source of toIntArray(ArrayList input)

Description

Convert an ArrayList to a simple Array

License

Open Source License

Parameter

Parameter Description
input An Integer ArrayList

Return

A simple Int Array

Declaration

public static int[] toIntArray(ArrayList<Integer> input) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    /**//  w ww .j  a v  a2s .c om
     * Convert an ArrayList to a simple Array
     * @param input An Integer ArrayList
     * @return A simple Int Array
     */
    public static int[] toIntArray(ArrayList<Integer> input) {
        int len = input.size();
        int[] output = new int[len];
        for (int i = 0; i < len; i++) {
            output[i] = input.get(i);
        }
        return output;
    }
}

Related

  1. toBooleanArray(ArrayList items)
  2. toByteArray(ArrayList in)
  3. toIntArray(ArrayList list)
  4. toIntArray(ArrayList array)
  5. toIntArray(ArrayList array)
  6. toStringArr(ArrayList al)
  7. toStringArray(ArrayList src)
  8. toStringArray(ArrayList src)
  9. toStringArrayList(final Object... array)