String resultsStr[] = {"2", "1", "5", "1"};
ArrayList intermediate = new ArrayList();
for(String str : resultsStr)
{
intermediate.add(Integer.parseInt(str, 10)); //the 10 could be ommitted
}
int resultsInt[] = intermediate.toArray();
and your resultsInt[]
will contain the array of ints. While I agree that it doesn't have to go thru the arraylist (it can be accomplished without it) i used it merely because it was easier to type out.