Back to project page QuestCompass.
The source code is released under:
Apache License
If you think the Android project QuestCompass listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.renard.radar; // w w w .j a v a 2 s . co m public class Util { public static String buildDistanceString(final float distanceMeters) { float distance = distanceMeters; String format; String unit; if (distanceMeters >= 1000) { distance /= 1000; unit = "km"; format = "%,.2f%s"; } else { unit = "m"; format = "%,.0f%s"; } return String.format(format, distance, unit); } public static String buildSpeedString(final float speedMPerSecond) { float speed = speedMPerSecond * 3.6f; String format = "%.1f\n%s"; String unit = "km/s"; return String.format(format, speed, unit); } }