Here you can find the source of formatIncludeCommas(final Number object)
Parameter | Description |
---|---|
object | Contains the value that needs to be converted. |
public static String formatIncludeCommas(final Number object)
//package com.java2s; import java.text.DecimalFormat; public class Main { /**// ww w.ja va 2s. c o m * Holds reference to the US Decimal formatter. */ private static final DecimalFormat NUMBER_FORMATTER = new DecimalFormat("###,###,###"); /** * Format numbers for display as comma separated groups. * * @param object * Contains the value that needs to be converted. * @return Returns comma separated formatted values. */ public static String formatIncludeCommas(final Number object) { if (object == null) { return ""; } return NUMBER_FORMATTER.format(object); } }