Skip to content

Instantly share code, notes, and snippets.

@jukbot
Created December 1, 2015 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jukbot/b494d8eb562b575cd825 to your computer and use it in GitHub Desktop.
Save jukbot/b494d8eb562b575cd825 to your computer and use it in GitHub Desktop.
public class ASCIItable
{
public static void main(String[] args) {
final char EXCLAIM = '!';
final char TILDE = '~';
char c = (char) 0;
int row =0;
while( c <= TILDE) {
System.out.printf("%4d", row++);
for(int i =0; i < 10; i++) {
if(c >= EXCLAIM && c <= TILDE) {
System.out.printf("%4d", c);
}
else
{
System.out.printf("%4ds", "");
}
c = (char) (c+1);
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment