java - How to convert ArrayList<Integer> to an int[]? -


i have array saved in strings.xml.
want how many items there in list, , put in list.

for example, if string contains {"one", "two", "three"},
want int contains {0,1,2}.

from know, way use arraylist, use add method.

here code i'm using make this:

string[] names; arraylist<integer> mylist;  (int = 0; < names.length; i++){   mylist.add(i); } 

but problem don't know how change arraylist<integer> int[].
how can done?

if want create int[] array of numbers 0 names.length, how it:

int[] numbers = new int[names.length]; (int = 0; < names.length; i++) {     numbers[i] = i; } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -