If i want to store values of integers from 0 to 1000 with increments of 20, what would be the easiest way to put those values into the array? And what about a 2D-array?

there has to be an easier way than this, right?:

int numbers = {0,20,40,60,80,100,120,140,etc,etc};

This is my attempt. Not sure if itâ€™d work for any range though:

```
static final int MIN = 0, MAX = 1000, STEP = 20;
static final int LEN = (MAX - MIN) / STEP + 1;
final int[] nums = new int[LEN];
void setup() {
for (int i = 0; i < LEN; nums[i] = i++ * STEP + MIN);
println(nums);
exit();
}
```

2 Likes