int x = 1; int iIncr = +1; while(x>0) { System.out.print(x); x += iIncr; if (x>0) System.out.print(", "); if (x>9) {// x = 10; iIncr = -1; } }