title: android number format
body: <p>In my app want to round a double to 2 significant figures after decimal point. I tried the code below.</p>
  
  <pre><code>public static double round(double value, int places) {
  long factor = (long) Math.pow(10, places);
  value = value * factor;
  long tmp = Math.round(value);
  return (double) tmp / factor;
  }
  </code></pre>
  
  <p>also i tried</p>
  
  <pre><code>double val = ....;
  val = val*100;
  val = (double)((int) val);
  val = val /100;
  </code></pre>
  
  <p>both code do not working for me. </p>
  
  <p>Thanks in advance....</p>