// Use Integer Wrapper class to print out int with commas import java.io.*; public class wrapperDriver {public static input in = new input(); public static void printWithCommas(int n) {Integer nu = new Integer(n); String s = nu.toString(); for (int x=0; x< s.length(); x++) {System.out.print(s.substring(x,x+1)); if ((s.length()-x) % 3 == 1 && x < s.length()-1) System.out.print(","); } } public static String addCommas(int n) {Integer nu = new Integer(n); String s = nu.toString(); String t = ""; for (int x=0; x< s.length(); x++) {t += s.substring(x,x+1); if ((s.length()-x) % 3 == 1 && x < s.length()-1) t += ","; } return t; } public static void main(String[] args) throws IOException {int n; System.out.print("Enter a number "); n = in.getInt(); printWithCommas(n); System.out.println(); String nu = addCommas(n); System.out.println(nu); System.out.println(); }}