Changeset 1237


Ignore:
Timestamp:
08/10/06 13:57:12 (14 years ago)
Author:
curtis
Message:

Better spacing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/utils/Ascii.java

    r1236 r1237  
    99    int max = 255; 
    1010    if (args.length > 0) max = Integer.parseInt(args[0]); 
     11    if (max > 99999) max = 99999; // cap at 5 digits 
     12    int digits = 1; 
     13    int q = max; 
     14    while (q >= 10) { 
     15      q /= 10; 
     16      digits++; 
     17    } 
    1118    for (int i=32; i<=max; i++) { 
    1219      String s = "" + i; 
    13       if (i < 100) s = " " + s; 
    14       if (i < 10) s = " " + s; 
     20      while (s.length() < digits) s = " " + s; 
    1521      System.out.print(s + " " + (char) i + "\t"); 
    1622      if (i % 10 == 1) System.out.println(); 
Note: See TracChangeset for help on using the changeset viewer.