public int [ ] next ( ) { if ( ! hasNext ) return null ; int [ ] result = new int [ r ] ; for ( int i = 0 ; i < r ; i ++ ) result [ i ] = index [ i ] ; moveIndex ( ) ; return result ; }
Get the next permutation .