I changed only your conditions in if
clause
for (int i = 0; i < apps; i++) {
if ( i<4) {
Row1.append("<td>" + i + "</td>");
}
if (i>3 && i<8) {
Row2.append("<td>" + i + "</td>");
}
}
Output :
Row1 : 0123
Row2 : 4567
Working demo : http://ideone.com/PMiknB .dint tried any html part