Splitting integers in arrays to individual digits

Posted by Neville on Stack Overflow See other posts from Stack Overflow or by Neville
Published on 2010-04-27T15:52:09Z Indexed on 2010/04/27 16:03 UTC
Read the original article Hit count: 403

Filed under:
|
|
|

hello all.

I have an array:

int test[]={10212,10202,11000,11000,11010};

I want to split the inetger values to individual digits and place them in a new array as individual elements such that my array now is:

int test2[]={1,0,2,1,2,1,0,2,0,2,1,1,0,0,0,1,1,0,0,0,1,1,0,1,0};

How would i go about doing that? I'm doing this in java.

Thank you.

© Stack Overflow or respective owner

Related posts about java

Related posts about arrays