Java Meter to Kilometer meterToKilometer(long number)

Here you can find the source of meterToKilometer(long number)

Description

meter To Kilometer

License

Apache License

Declaration

public static String meterToKilometer(long number) 

Method Source Code


//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*/
}