Appending Integer array elements in Java

Posted by Neville on Stack Overflow See other posts from Stack Overflow or by Neville
Published on 2010-04-28T10:08:15Z Indexed on 2010/04/28 10:13 UTC
Read the original article Hit count: 279

Filed under:
|
|
|

I have an array, say

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

I need to append each of the 5 neighboring elements and assign them to a new array b with length=(a.length/5); and i want to append the 5 neighboring elements so that I have: int b[]={20101,10211,10101}; I need to do this for various length arrays, in most cases with length of a being greater than 15.

Any help would be greatly appreciated, I'm programming in Java.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about arrays