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?

  • If you want someone to help you, take the trouble to design your question so that others will also understand what needs to be done. - pavlofff

1 answer 1

You incorrectly specify the boundaries. For 4x4:

 for(int ii = 0; ii < pow(2,n); ii++){//strings of the truth table for(int jj = 0; jj < pow(2,n); jj++){//rows... ...