Harmonic Series
<p>I'm having an issue in getting a PHP script moved over to Java. I'm working with a harmonic series set. I have it working in PHP, but when I convert it to Java, it never ends (infinite loop). Any ideas? Or even a better way to get it done?</p>

<p>The PHP:</p>

<pre><code>&lt;?php

$current = 0;
$num = 2.5;

while($current &lt; $num) {
    for($i = 1; $current &lt; $num; $i++) {
        $current = $current + (1 / $i);
    }

    // this ($current) will return "2.5928571428571" (which it should)
    echo $current;
}

?&gt;
</code></pre>

<p>The Java (the Java equivalent, but not finishing the loop):</p>

<pre><code>double current = 0;
double num = 2.5;
int i = 0;

while(current &lt; num) {
    for(i = 1; current &lt; num; i++) {
        current = current + (1 / i);
    }

    System.out.println(current);
}
</code></pre>

<p>Or maybe I'm totally doing it wrong :o.</p>
