How to Convert an ArrayList Containing Integers to Primitive Int Array? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In Java, ArrayList is the pre-defined class of the Java Collection Framework. It is part of the java.util package. ArrayList can be used to add or remove an element dynamically in the Java program. It can be snipped dynamically based on the elements added or removed into the ArrayList. In this article, we will discuss how to convert an ArrayList containing Integers to a primitive int array. Methods to Convert an ArrayList containing Integers to Primitive Int ArrayTwo methods are mostly used to implement the ArrayList integers convert into a primitive integer array. add(): It is a pre-defined method of the ArrayList that can be used to add the elements into the ArrayList.get(): it is also an in-built method and it can be used to retrieve the elements into the ArrayList.Program to Convert an ArrayList Containing Integers to Primitive Int Array in Java Java // Java Program to convert an ArrayList // Containing Integers to primitive int array import java.util.ArrayList; //ArrayList convert into the primitive int array public class GFGexample { //main method public static void main(String[] args) { // Create the ArrayList named as arrayList ArrayList<Integer> arrayList = new ArrayList<>(); arrayList.add(10); arrayList.add(50); arrayList.add(100); arrayList.add(150); // Convert ArrayList<Integer> to int[] int[] intArray = convertToIntArray(arrayList); // print the result System.out.print("Original ArrayList: " + arrayList); System.out.println("\nConverted int array: " + java.util.Arrays.toString(intArray)); } // method to convert ArrayList<Integer> to int[] private static int[] convertToIntArray(ArrayList<Integer> list) { int[] intArray = new int[list.size()]; for (int i = 0; i < list.size(); i++) { intArray[i] = list.get(i); } return intArray; } } OutputOriginal ArrayList: [10, 50, 100, 150] Converted int array: [10, 50, 100, 150] Explanation of the Program:The above program is the example of the ArrayList can be convert into primitive integer array that Integer is the wrapper class that values can be convert into the normal primitive integer values into the program. It can be implemented first we have to create one Integer ArrayList then add the integer values into the ArrayList after that we can convert the ArrayList into the primitive integer. Comment More infoAdvertise with us Next Article Program to Convert Stream to an Array in Java K kadambalamatclo Follow Improve Article Tags : Java Java Programs Arrays Java-Arrays Java-ArrayList +1 More Practice Tags : ArraysJava Similar Reads Java Program to Convert Integer List to Integer Array There are many ways to convert integer List to ArrayList where in this article we will be discussing out 2 approaches as below: Using concept od streams in Java8Using Apache Commons LangUsing Guava Library Method 1: Using concept od streams in Java8 So, first, we will get to know about how to conver 3 min read Program to Convert Stream to an Array in Java A Stream is a sequence of objects that support various methods which can be pipelined to produce the desired result. An array is a group of like-typed variables that are referred to by a common name. An array can contain primitives data types as well as objects of a class depending on the definition 3 min read Program to Convert Stream to an Array in Java A Stream is a sequence of objects that support various methods which can be pipelined to produce the desired result. An array is a group of like-typed variables that are referred to by a common name. An array can contain primitives data types as well as objects of a class depending on the definition 3 min read Program to Convert Stream to an Array in Java A Stream is a sequence of objects that support various methods which can be pipelined to produce the desired result. An array is a group of like-typed variables that are referred to by a common name. An array can contain primitives data types as well as objects of a class depending on the definition 3 min read Java Program to Convert String to Integer Array In Java, we cannot directly perform numeric operations on a String representing numbers. To handle numeric values, we first need to convert the string into an integer array. In this article, we will discuss different methods for converting a numeric string to an integer array in Java.Example:Below i 3 min read Java Program to Change a Collection to an Array An array is a data structure that can hold a fixed-size, homogeneous collection of elements of the same data type, which can be either primitive data types (e.g., int, float) or object references. However, the size of the array cannot be changed once it is created. On the other hand, a collection is 3 min read Like