title: Java Set double value with all decimal point and get only 2 digit after decimal point
body: <p>In java , I have confusion about store and get double value.
  Currently i am creating software where some accounting part included,i want to store calculated value same as they are calculated like 202.234234234212312 and while in display i want to display it as 202.23 in 2 digit after decimal point.
  and in calculation i want to do calculation with 2,4 or 6 digit.</p>
  
  <p>for that i have 2 option</p>
  
  <ol>
  <li><p>Store value as it is calculated and in getter method of amount field, i can format it like.</p>
  
  <pre><code>private Double amount;
  public Double getAmount() {
      DecimalFormat df2 = new DecimalFormat(".##");
      return Double.valueOf(df2.format(amount));
  }
  </code></pre></li>
  </ol>
  
  <p>but problem with this method is , it will get formatted number at all time i get amount. i can't get actual stored amount.</p>
  
  <ol start="2">
  <li><p>i can use 2 separate field for get and set.</p>
  
  <pre><code>private Double amount;
  private Double amountFormatted;
  
  public Double getAmount() {
      return amount;
  }
  
  public Double getAmountFormatted() {
      DecimalFormat df2 = new DecimalFormat(".##");
      return Double.valueOf(df2.format(amountFormatted));
  }
  </code></pre></li>
  </ol>
  
  <p>so please provide better way to store and get decimal value, Thank you.</p>