-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathA.java
More file actions
35 lines (27 loc) · 641 Bytes
/
Copy pathA.java
File metadata and controls
35 lines (27 loc) · 641 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package findJoinPoint;
public class A {
public static void main(String[] args) {
String art=AsciiArt.printChar('A');
System.out.println(art);
char c=A.scanChar(art);
System.out.println(c);
}
public static char scanChar(String s) {
int hashcodeS = s.hashCode();
for (char c = 'A'; c <= 'Z'; c++) {
// Check to see if the character corresponds with the ASCII art.
int ascii = c;
if (ascii == hashcodeS) {
// Return the character if it does.
return c;
}
}
return (char) '?';
}
}
class AsciiArt {
public static String printChar(char s) {
String c = Character.toString(s);
return c;
}
}