Custom Format Number

25 03 2008

DecimalFormatSymbols sym = new DecimalFormatSymbols();
sym.setGroupingSeparator('-');
NumberFormat accFormatter = new DecimalFormat("###,###,####,######",sym);
BigDecimal num = new BigDecimal("1111111111111111");
String formattedNum = accFormatter.format(num);

formattedNum = 111-111-1111-111111

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: