Traverse each row
for ( int i = 0 ; i < mat . length ; i ++ ) { Vector < Integer > arr = new Vector < Integer > ( ) ; for ( int j = 0 ; j < mat [ i ] . length ; j ++ ) { arr . add ( mat [ i ] [ j ] ) ; }