Java tutorial
//package com.java2s; public class Main { public static String getSpace(String range) { String space = ""; float r = Float.parseFloat(range); if (r >= 1000) { space = (r / 1000 + 0.5f) + "km"; } else { space = r + "m"; } return space; } }