Here you can find the source of distance(float distanceInKm, boolean imperial)
public static String distance(float distanceInKm, boolean imperial)
//package com.java2s; //License from project: Open Source License public class Main { private static final float ratio = 1.609344f; public static String distance(float distanceInKm, boolean imperial) { float distance = distanceInKm; if (imperial) { distance = distance / ratio; }//from www .j a va 2 s. c om return String.format("%02.02f", distance); } }