Percentage Calculation for values less than 1 and greater than 0
<p>I am trying to display the percentage using BigDecimal.</p>

<p>for example if i have to do </p>

<pre><code>    double val = (9522 / total ) * 100;

    System.out.println("Val is :" + val);
</code></pre>

<p>where total is 1200000.</p>

<p>I want to display the calculation as a percentage but since the calculation comes to a value less than 0 , I am unable to display the percentage</p>

<p>I also tried </p>

<pre><code>    BigDecimal decimal = new BigDecimal((9522 * 100 ) / total);
    BigDecimal roundValue = decimal.setScale(2, BigDecimal.ROUND_HALF_UP);
    System.out.println("decimal: " + decimal);
    System.out.println("roundValue: " + roundValue);
</code></pre>

<p>but with the same result.</p>

<p>How can I display the percentage even if it is in Decimals?</p>
