Это мой слот для преобразования числа (от 0 до 9) в символ *, как в вашем примере:
class JavaApplication57 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<Letter> ar = new ArrayList<>();
System.out.println("Please input string: ");
String s = sc.next();
for (char c : s.toCharArray()) {
ar.add(JavaApplication57.convertToLetter(c));
}
for (int i = 0; i < 5; i++) {
for (Letter l : ar) {
System.out.print(l.getLine(i) + " ");
}
System.out.println("");
}
}
static Letter convertToLetter(char ch) {
String a = "****",
b = "* *",
c = " *",
c2 = "*",
d = "* ",
e = "* * ",
f = " * ";
switch (ch) {
case '0':
return new Letter(a, b, b, b, a);
case '1':
return new Letter(c2, c2, c2, c2, c2);
case '2':
return new Letter(a, c, a, d, a);
case '3':
return new Letter(a, c, a, c, a);
case '4':
return new Letter(d, e, a, f, f);
case '5':
return new Letter(a, d, a, c, a);
case '6':
return new Letter(a, d, a, b, a);
case '7':
return new Letter(a, c, c, c, c);
case '8':
return new Letter(a, b, a, b, a);
case '9':
return new Letter(a, b, b, c, a);
}
return null;
}
}
class Letter {
private String line1, line2, line3, line4, line5;
public Letter(String line1, String line2, String line3, String line4, String line5) {
this.line1 = line1;
this.line2 = line2;
this.line3 = line3;
this.line4 = line4;
this.line5 = line5;
}
public String getLine(int i) {
switch (i) {
case 0:
return line1;
case 1:
return line2;
case 2:
return line3;
case 3:
return line4;
case 4:
return line5;
default:
throw new AssertionError();
}
}
}
Надеюсь на помощь