For example, if I wanted all binary strings of length 3 I could simply declare them like this:
boolean[] str1 = {0,0,0};
boolean[] str2 = {0,0,1};
boolean[] str3 = {0,1,0};
boolean[] str4 = {0,1,1};
boolean[] str5 = {1,0,0};
boolean[] str6 = {1,0,1};
boolean[] str7 = {1,1,0};
boolean[] str8 = {1,1,1};
What is the most efficient way to generate all possibly binary strings of length N into a boolean array?
I don't necessarily need the most efficient method, just one that's fairly efficient and easy for me to multithread.
EDIT: I should note that I will be storing them all in an ArrayList, if that matters.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…