Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created June 24, 2011 15:52
Show Gist options
  • Select an option

  • Save chanwit/1045069 to your computer and use it in GitHub Desktop.

Select an option

Save chanwit/1045069 to your computer and use it in GitHub Desktop.
public static void g(char ch, boolean big) {
System.out.printf("g('%c',%s) = ", ch, big);
if (big == true) {
int d = ch - 'A';
for (int i = 0; i <= 25; i++) {
int k = (d + i) % 26;
System.out.printf("%c", 'A' + k);
}
System.out.println();
} else {
int gap = 'a' - 'A';
int d = ch - 'a' + gap;
for (int i = 0; i <= 25; i++) {
int k = (d + i) % 26;
System.out.printf("%c", 'a' + k);
}
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment