import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.lang.*; import java.math.BigDecimal; import java.text.NumberFormat; import java.text.DecimalFormat; /** * Sample for NumberFormat. */ class NumberFormatSample { /** * Do it. */ public void doIt() { NumberFormat form = new DecimalFormat("##,###"); BufferedReader ins = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = ins.readLine()) != null) { BigDecimal x = new BigDecimal(line); System.out.println("x = " + form.format(x)); } return; } public static void main(String args[]) throws IOException { NumberFormatSample sample = new NumberFormatSample(); sample.doIt(); } }