path . append ( maze [ j ] [ k ] ) If we hit this block , it means one path is completed . Add it to paths list and print
System . out . print ( " [ " + path . get ( 0 ) + " , ▁ " ) ; for ( int z = 1 ; z < path . size ( ) - 1 ; z ++ ) { System . out . print ( path . get ( z ) + " , ▁ " ) ; } System . out . println ( path . get ( path . size ( ) - 1 ) + " ] " ) ; allPaths . add ( path ) ; return ; }