I want to program the iteration of the number e
<p>I'm still a beginner in Java programming, and I'm using Eclipse Neon. How can I make it like that without writing the code again and again? And at the end, I want to print the final number on the screen.</p>

<p>Here's what I did so far:</p>

<pre><code>public class othermethod {
    public static void main(String[] args) {
        int position = 1;
        int pos = 0;
        int[] zahlenlaenge = new int[100];
        for (int i = 0; i &lt; zahlenlaenge.length; i++) {
            zahlenlaenge[pos] = position;
            position++;
            pos++;
            System.out.println(pos);
        }
    }
}
</code></pre>

<p>How it should actually work:</p>

<p><a href="https://i.stack.imgur.com/IGDcJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IGDcJ.png" alt="e function"></a></p>