所以我試圖創建一個AClass(es)
的AClass(es)
7-switch String
參數,其中每個字符都在[1]或關[0],例如: 0011010
。Java - 通過輸入掩碼xxxxxxx循環所有輸入,其中x = 0或1
ArrayList<AClass> AList = new ArrayList<AClass>();
public BClass() {
// I believe there is 128 unique ways to arrange between 0000000 and 1111111
for (int i = 0; i < ?; i++) {
// I assume I would need to create the String some how here and use that.
String str;
AList.add(new AClass("0000000"));
/* Each loop would create a new one, you get the idea.
AList.add(new AClass("1000000"));
AList.add(new AClass("1100000"));
AList.add(new AClass("1110000"));
...
...
AList.add(new AClass("1001010"));
...
...
AList.add(new AClass("1111111"));
*/
}
}
什麼是創建所有128個唯一參數AClass(es)的最有效方法?
編輯:誤以0000001開工100萬而不是
你不能使用二進制嗎? (有一些聰明的格式,應該這樣做) – 2017-03-31 17:42:32
你可能是對的,我應該能夠弄清楚,以及壞的問題。 – Daedric