Here you can find the source of formatToastDist(String message, int value, String unit)
public static String formatToastDist(String message, int value, String unit)
//package com.java2s; public class Main { public static String formatToastDist(String message, int value, String unit) {//from w w w. j a v a 2s . c o m if (unit.equals("km")) message += ": " + value + " km"; else message += ": " + KmToMiles(value) + " miles"; return message; } public static int KmToMiles(int distance) { double dist = distance * 0.621; return (int) dist; } }