This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Integer array to int array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Integer array to int array" Watch "Integer array to int array" New topic
Author

Integer array to int array

Julien Roubieu
Greenhorn

Joined: Nov 16, 2005
Posts: 10
Hi all,

Is there a way to transform an Integer[] to an int[] and vice-versa without looping through the array ?

Julien
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
I daresay that is no possible.

If what you actually mean is that you do not want to write the algoritm then use Jakarta Commons ArrayUtils class, it has a method int[] toPrimitive(Integer[])

And this is what the algorithm does:



I hope that helps!
 
Don't get me started about those stupid light bulbs.
 
subject: Integer array to int array