Possible Duplicate:
Converting an array of objects to an array of their primitive types.

Hi all,

IS it possible to convert an array of Integer object to an array of int? i know its possible but is there any java function that does this kind of thing so one doesnt have to implement it self?

thank u

share|improve this question
feedback

closed as exact duplicate by Tim Bender, Jeff Atwood May 7 '11 at 11:18

This question covers exactly the same content as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

3 Answers

Not built right in to Java, but how about using the Guava library?

Ints.toArray() will do what you need.

http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/primitives/Ints.html#toArray(java.util.Collection)

share|improve this answer
feedback

No, unfortunately. You have to loop through the array.

share|improve this answer
feedback

Check this link:

http://www.coderanch.com/t/404571/java/java/Integer-array-int-array

share|improve this answer
2  
This would serve better as a comment. – mre May 3 '11 at 17:53
OKAY! Will take care from next time. Thanks :) – Chankey Pathak May 3 '11 at 17:55
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.