View Single Post
  #4 (permalink)  
Old 03-22-2008, 02:30 AM
Bluefox815 Bluefox815 is offline
Member
 
Join Date: Feb 2008
Location: Oregon, USA
Posts: 24
Bluefox815 is on a distinguished road
Send a message via MSN to Bluefox815
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

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

Code:
/* 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; } }

Last edited by Bluefox815 : 03-22-2008 at 02:33 AM.
Reply With Quote