title: Alternate method for toFixed function in Java
body: <p>I have the values where the last 2 digits valve must be round figured. This functionality I can achieve in JavaScript <strong>toFixed(6)</strong> . But how we can achieve the same in java code</p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>Input=75.74306816000052
  Input =26.910038862000476
  
  Output=75.743070
  Output=26.910040
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>BigDecimal Output= new BigDecimal(Input).setScale(6, RoundingMode.HALF_EVEN)
  </code></pre>
  
  <p>But the output values coming hear are</p>
  
  <pre><code>75.743068
  26.910038
  </code></pre>