mod m will help in traversing the blocks from starting block after we reach the end .
j = ( j + 1 ) % m ; } } System . out . print ( " Process No . Process Size Block no . "); for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( i + 1 + " TABSYMBOL TABSYMBOL " + processSize [ i ] + " TABSYMBOL TABSYMBOL " ) ; if ( allocation [ i ] != - 1 ) { System . out . print ( allocation [ i ] + 1 ) ; } else { System . out . print ( " Not ▁ Allocated " ) ; } System . out . println ( " " ) ; } }