Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

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

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

share|improve this answer

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

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