Here you can find the source of meterToKilometer(long number)
public static String meterToKilometer(long number)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.text.DecimalFormat; public class Main { public static String meterToKilometer(long number) { BigDecimal newNumber = new BigDecimal(number); BigDecimal result = newNumber.divide(new BigDecimal(1000)); DecimalFormat df = new DecimalFormat("#.0"); return df.format(result); }/*from w w w. ja va2 s . co m*/ }