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 Company Preparation K kadambalamatclo Follow Improve Article Tags : Java Java Programs Arrays Java-Arrays Java-ArrayList +1 More Practice Tags : ArraysJava Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like