round up to 2 decimal places in java?
<p>I have read a lot of stackoverflow questions but none seems to be working for me. i am using <code>math.round()</code> to round off.
this is the code:</p>

<pre><code>class round{
    public static void main(String args[]){

    double a = 123.13698;
    double roundOff = Math.round(a*100)/100;

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

<p>the output i get is: <code>123</code> but i want it to be <code>123.14</code>. i read that adding <code>*100/100</code> will help but as you can see i didn't manage to get it to work.</p>

<p>it is absolutely essential for both input and output to be a double.</p>

<p>i am a beginner at java and that is why i am a troubled guy.</p>

<p>it would be great great help if you change the line 4 of the code above and post it.</p>

<p>thanks a ton! </p>
