So I am to be making a "bit pattern that will have 7 rows. I am having trouble drawing any letters with 1's and 0's while I can only use if or else statements, parse.Int, and compareTo as the instructions say. The program needs to change every 1 to an "X" and every 0 to a space. Is there a specific way to do this? For now it just endlessly loops. Thanks for any and all help. Here is my code thus far:
public static void main(String[] args)
{
String r1 = ("1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0");
String r2 = ("0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0");
String r3 = ("0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0");
String r4 = ("0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0");
String r5 = ("0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0");
String r6 = ("0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0");
String r7 = ("0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0");
dr(r1);
dr(r2);
dr(r3);
dr(r4);
dr(r5);
dr(r6);
dr(r7);
}
public static void dr(String s)
{
int i = 0;
while(i < 1)
{
String[] tokens = s.split(" ");
if (tokens[0].compareTo("0") == 0)
System.out.println("X");
else if (tokens[1].compareTo("1") == 1)
System.out.println(" ");
}
}