static void joinGroup(long groupId1, long groupId2, Cell[] row) { for (Cell cell : row) { if (cell.groupId == groupId2) { cell.groupId = groupId1; } } }