Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert an Integer Vector to int array

807605Jun 24 2007 — edited Jun 25 2007
I need an int[] array for which I do not know the length at compilation time.

So I am using a Vector vector = new Vector(), the elements of which I define as of type Integer.

However, I have a method which calls an int[] array and not a Vector.

How can I convert my vector to an int[] array?

I cannot just use vector.toArray(), because this makes an Object[] array, out of which I can make an Integer[] array, but not an int[] array.

How can I make an int[] array?

Thanks for looking at this!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2007
Added on Jun 24 2007
17 comments
2,330 views