To calculate the distance between two places;with the two lat and longi using this link too Calculate distance in meters when you know longitude and latitude in java
i got my result as metre like 2.4737676E-5,its a float value too.
i want to take as first two values only after decimal.But using the decimal format and string format also i couldn't get my expected result like(2.47)..its coming as 0.00 only.
> float meanwhiledist=distFrom(latti,longii,curlat,curlongi);
> DecimalFormat df2 = new DecimalFormat( "#.00");
> double dd2dec = new Double(df2.format(meanwhiledist));
or
Double dd = Double.valueOf(meanwhiledist);
String angleFormated = String.format("%.2f", dd);
if i print angleformated and dd2dec my result coming as 0.00
The value of 2.4737676E-5 seems to be less than you expect:
Output:
The output you get is actually correct since it returns the first 2 decimal places from 0.000.....