title: How to print upto two decimal places in java using string builder?
body: <p>hi i am trying to print after dividing in string builder and printing that string builder let show me my code ,</p>
  
  <pre><code>string.append("Memomry usage:total:"+totalMemory/1024/1024+
  "Mb-used:"+usageMemory/1024/1024+
  " Mb("+Percentage+"%)-free:"+freeMemory/1024/1024+
  " Mb("+Percentagefree+"%)");
  </code></pre>
  
  <p>in above code "totalmemory" and "freememory" is of double type having bytes value in point not null so i divide it by "1024" two times to get it in "Mb" and "string" is variable of string builder after using this code i am simply printing it a am getting result as shown below,</p>
  
  <pre><code>Used Memory:Memomry usage: 
  total:13.3125Mb-used:0.22920989990234375Mb (0.017217645063086855%)
  -free:13.083290100097656Mb (0.9827823549369131%)
  </code></pre>
  
  <p>i want to get percentage in twodecimal place and values of used and free memory in mb like this "used:2345.25" in this pattren remember </p>
  
  <p>Hopes for your suggestions </p>
  
  <p>Thanks in Advance</p>