what I am trying to put all possible 256 binary bit sequences into a string array. In order to do that, I have created 8 for loops to have all the possible cases. Here's what I've tried so far.
static String[] BitSequences() {
int[] result = new int[256];
for (int a = 0; a < 256; a++) {
for (int i = 0; i < 2; i++){
for (int j = 0; j < 2; j++){
for (int k = 0; k < 2; k++){
for (int l = 0; l < 2; l++){
for (int m = 0; m < 2; m++){
for (int n = 0; n < 2; n++){
for (int o = 0; o < 2; o++){
for (int p = 0; p < 2; p++){
result[a] = ; //this part is a problem
}
}
}
}
}
}
}
}
}
String str = Arrays.toString(result);
System.out.println(str);
return str;
}
This method is supposed to return a string array that contains all the possible cases. However, I don't know how to insert these value by making for-loops using int values. It is easy to print it out: ' System.out.println(i+j+k+.....+p) ' any help would be appreciated!