int []b=new int[a.length]; int index=0; while(index<b.length-1){ b[index]=a[index]+a[index+1]; index++; } b[index]=a[index]; return b;