Java examples for java.lang:int Format
convert int To String with NumberFormat
//package com.java2s; import java.text.NumberFormat; public class Main { public static void main(String[] argv) { double value = 42.45678; System.out.println(convertToString(value)); }/*from w ww. j a v a2 s . c o m*/ /** * @param value * @return */ public static String convertToString(double value) { return convertToString((int) value); } /** * @param value * @return */ public static String convertToString(int value) { return "$" + NumberFormat.getInstance().format(value); } }