i have a 2 array with that display value of a matrix .I have use 2 for loops and a string builder to display the values.The problem is that the values are displayed in a single line i want it to display it as a matrix format.
I my program i use string 1=”bbabb” and string 2=”aaabb” i compare each value and build a matrix accordingly with give me 25 values…but when displayed in my text area it show it like that “0000000100001000102101013” but i want to display it like that
0 0 0 0 0
0 0 1 0 0
0 0 1 0 0
0 1 0 2 1
0 1 0 1 3
I am quite new to java.Can someone explain me the logic or give me a sample code where i can change the first string format to the second one.Thank you
You need to append a newline
"\n"in between each row, when using your StringBuilder, e.g.Obviously, adapt the above to fit in with your nested
forloops…