java - How to mark that at which i something = true -


  (int i=1;i<10;i++)   {         if == true                     else                } 

here want do: outside loop for, need summarize @ something = true , @ something = false.

list<integer> positiveresults = new arraylist<integer>(); list<integer> negativeresults = new arraylist<integer>();  (int = 1; < 10; i++) {     if (somecondition)         positiveresults.add(i);     else         negativeresults.add(i); } 

where somecondition supposed boolean variable or expression.

if explicitly want results in array instead of list, add

integer[] resultsinarray = positiveresults.toarray(         new integer[positiveresults.size()]); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -