Compute Pascal’s Triangle
// Yield Pascal's triangle with size rows
public static int[][] calculatePascal(int size) {
int[][]p= new int[size][]; //the triangle
for (int r= 0; r != size; r= r+1) {
// Allocate row i of triangle --its r+1 values
// Calculate row r of Pascal's triangle
for (int c= 1; c < r; c= c+1)
p[r][c]= p[r-1][c-1] + p[r-1][c];