public class Strings {
private static void show(int nc) {
String s = "";
long start = System.currentTimeMillis();
for (int i = 0; i < nc; i++) s = s + ".";
double elapsed = (System.currentTimeMillis() - start) / 1000.0;
System.out.printf("<tr><td>%d<td>%.3f", nc, elapsed);
}
public static void main(String[] args) {
System.out.println("<html><head>");
System.out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../teaching.css\">");
System.out.println("</head><body><table border><tr><td>Length<td>Seconds");
show(1000);
show(10000);
show(100000);
show(1000000);
System.out.println("</table></body></html>");
}
}