Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Convert Wrapper value array list into primitive array in Java

import java.util.ArrayList;
public class Demo {
	public static void main(String[] args) {
		ArrayList<Integer>arrList = new ArrayList<Integer>();
		arrList.add(5);
		arrList.add(10);
		arrList.add(15);
		arrList.add(20);
		arrList.add(25);
		arrList.add(30);
		arrList.add(45);
		arrList.add(50);
		final double[] arr = new double[arrList.size()];
		int index = 0;
		for (final Integer value: arrList) {
			arr[index++] = value;
		}
		System.out.println("Elements of double array...");
		for (Double i: arr) {
			System.out.println(i);
		}
	}
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.