public static int stirling( int n, int k ) {
        if ( ( n > 0 && k == 0 ) || k > n ) return 0;
        if ( stirling.length <= n ) {
            int[][] newStirling = new int[n+1][n+1];
            for ( int i = 0; i <= n; i++ ) {
                if ( i < stirling.length ) {
                    System.arraycopy( stirling[i], 0, newStirling[i], 0, i+1 );
                } else {
                    for ( int j = 1; j <= i; j++ ) {
                        newStirling[i][j] = ( i - 1 ) * newStirling[i-1][j] + newStirling[i-1][j-1];
                    }
                }
            }
            stirling = newStirling;
        }
        return stirling[n][k];
    }