Java tutorial
//package com.java2s; import java.util.Locale; public class Main { /** * * @param variation * @return */ public static String makeVariation(double variation) { int var = (int) Math.round(variation); String ret = String.format(Locale.getDefault(), "%02d", var); if (var < 0) { ret = "E" + var + "\u00B0 "; } else { ret = "W" + var + "\u00B0 "; } return ret; } }