There is an array:
int[][] a = new int [50][50]; Then I display it in a TextView object (table):
StringBuilder strBuild = new StringBuilder(); for(int ii = 0; ii <= pow(2,n); ii++){//strings of the truth table for(int jj = 1; jj <= pow(2,n); jj++){//rows... strBuild.append(a[ii][jj]); strBuild.append(" "); } strBuild.append("\n"); } table.setText(strBuild.toString()); and I get the following: Suppose n = 2 (in the program is determined dynamically):
0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 0 And I need to get:
0 0 1 0 0 1 0 1 1 0 1 1 1 1 1 0 How to do it?