class Convert {

    @NonNull
    public static String altitude(double m) {
        if (Double.isNaN(m)) {
            return "";
        } else if (Double.isInfinite(m)) {
            return Double.toString(m);
        } else {
            final String localUnits = metric ? "m" : "ft";
            final double localValue = metric ? m : m * 3.2808399;
            if (localValue < 999.5) {
                return Math.round(localValue) + " " + localUnits;
            } else {
                return String.format(Locale.getDefault(), "%.1f k%s", localValue * 0.001, localUnits);
            }
        }
    }

}