If you still need help, perhaps it would be easier to see your posted code, or if you like your privacy, an example.
I would use for statements, like in the below code
/* place this code wherever is preferable, I apologize for any mistakes in my code */
// the total number of println statements, i used the name objects for MyPrintObject
int objects = 20;
// all the lines you don't want to print, I chose random numbers
int[] exceptions = {2, 5, 7, 15, 17}
// other variables
MyPrintObject[] p = new MyPrintObject[objects];
boolean makeTrue = true;
for (int i = 0; i <= objects; i++) {
makeTrue = true;
for (int x = 0; x <= totalExceptions; x++) {
if (i == exception[x]) // if this object is equal to one of the exceptions, make it false
makeTrue = false;
}
if (makeTrue)
p[i] = new MyPrintObject(true);
else
p[i] = new MyPrintObject(false);
}
// print objects
for (i = 0; i <= objects; i++) {
if (p[i].print()) // for information on the print() method, see below
System.out.println(i);
}
Here is an example of MyPrintObject
/* My very simple MyPrintObject class */
public class MyPrintObject {
private boolean print;
public MyPrintObject() {
print = true;
}
public MyPrintObject(boolean b) {
print = b;
}
public boolean print() {
return print;
}
}