title: how can i reduce the digits after the decimal point?
body: <pre><code>     private void findLatLongDistance(double prelat,double prelon,double lat,double lon) {
      // TODO Auto-generated method stub
      try{
          double prelatval=prelat;
          double prelongval=prelon;
          double curlat=lat;
          double curlon=lon;
          Log.w("inside finalatlon...........................","the daya");
          if(prelatval&gt;0.0 &amp;&amp; prelongval&gt;0.0 &amp;&amp; lat&gt;0.0 &amp;&amp;  lat&gt;0.0 &amp;&amp; gpsdataElements.Speed&gt;0.0){
              float distance2 = getDistance(prelatval,prelongval,curlat,curlon);
              odometer_sum= (distance2/1000 );
              // for maximum value after decimal
              //df.setMaximumFractionDigits(0);
  
              //rounding the km digits after decimal
              Math.round(distance2);
  
              //for minimum distance after decimal
              df.setMinimumFractionDigits(2);
              df.format(odometer_sum);
              gpsdataElements.Distance = gpsdataElements.Distance + odometer_sum;
          }
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>here is my code. I want distance(i.e km)value digits after decimal is two digits. Example i want km value in 1.54km not like 1.4568923km. How to get like this.I tried a lot for that but i din't got any possible solution. Any one know please help me.</p>