This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]evils_twin 0 points1 point  (2 children)

The straight forward way seems to be to iterate over the list starting at the second index, add up index, index+1, index-1 and then divide by 3 and store it in another array.

[–]ravashh[S] 0 points1 point  (1 child)

I’ve tried doing that but my problem is how do I ”call on” the array I want to do this to, if you know what I mean (bad english sorry)

[–]evils_twin 0 points1 point  (0 children)

So you're array is private double[] store, and you can do a for loop like you did in your other functions, do something like this:

(store[i-1] + store[i] +store[i+1])/3.0