Here you can find the source of formatINT(int n)
public static String formatINT(int n)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatINT(int n) { String s = "" + n; s = reverse(s);/*from w w w . j a va 2 s. co m*/ String st = ""; for (int i = 0; i < s.length(); i++) { if (i != 0 && i % 3 == 0) st += ","; st += s.charAt(i); } return reverse(st); } public static String reverse(String ss) { String s = ""; for (int i = ss.length() - 1; i >= 0; i--) { s += ss.charAt(i); } return s; } }