float[] terms = new float[6];
for (int i = 1; i < 7; i++)
terms[i-1] = i/(float)(i+1);
or
float[] terms = new float[7];
for (int i = 1; i < 7; i++)
terms[i] = 1.0*i/(i+1);
or
float[] terms = {0, 1.0/2, 2.0/3, 3.0/4, 4.0/5, 5.0/6, 6.0/7};
- In first example it would be 6 in last two it would be 7.
The first example wastes no space, the other two waste the first element in the array (terms[0] is not used). However the other two are easier to understand and terms[1] = t1. In first example terms[0] = t1