 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert List<Integer> to int[] in Java?
You can simply iterate through list and fill the array as shown below −
import java.util.ArrayList; import java.util.List; public class Tester {    public static void main(String[] args) {       List<Integer> list = new ArrayList<>();       list.add(new Integer(1));       list.add(new Integer(2));       list.add(new Integer(3));       list.add(new Integer(4));       int[] array = new int[list.size()];       for(int i=0;i<array.length;i++) {          array[i] = list.get(i);          System.out.println(array[i]);       } } } Output
1 2 3 4
Advertisements
 