Here you can find the source of distanceInMeters(float distance)
public static String distanceInMeters(float distance)
//package com.java2s; public class Main { public static String distanceInMeters(float distance) { String distanceStr = ""; if (distance > 0) { if (distance >= 1000) { distanceStr = " " + Float.toString(distance / 1000).replace(".", ",") + " km"; } else { if (distance % 1 == 0) { distanceStr = " " + (int) distance + " m"; } else { distanceStr = " " + Float.toString(distance).replace(".", ",") + " m"; }/*from w w w . jav a2 s. c o m*/ } } return distanceStr; } }