Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String convertNumberToString(Number value, String pattern) { String s = null; try { if (pattern == null) { pattern = "###########0.00"; } DecimalFormat decimalFormat = new DecimalFormat(pattern); s = decimalFormat.format(value); } catch (Exception e) { e.printStackTrace(); } return s; } }