// File: TestNumber2.java (Module 8) // // Author: Rahul Simha // Created: October 6, 1998 // // Formatting integers. import java.text.*; public class TestNumber2 { public static void main (String[] argv) { for (int i=0; i<=1000; i+=200) { int sqr = i * i; // Create a DecimalFormat instance, specifying // width in the constructor. DecimalFormat df = new DecimalFormat ("#"); // Extract a string by passing an int. String s = df.format (sqr); // Print the string. System.out.println (s + " is the square of " + i); } } }