### Pascal's Triangle - Java Solution

Somehow I ended up here and decided to solve it in Java!

PascalTriangle.java
```package biz.tugay.pt;

public class PascalTriangle {

private PascalRow[] pascalRows;

public PascalTriangle(final int rows) {
pascalRows = new PascalRow[rows];

PascalRow previousRow = new PascalRow(1);
previousRow.getValues()[0] = 1;
pascalRows[0] = previousRow;

for (int row = 2; row <= rows; row++) {
final PascalRow pascalRow = new PascalRow(row);

pascalRow.getValues()[0] = previousRow.getValues()[0];
pascalRow.getValues()[pascalRow.getValues().length - 1] = previousRow.getValues()[previousRow.getValues().length - 1];

for (int i = 1; i < (row - 1); i++) {
pascalRow.getValues()[i] = previousRow.getValues()[i - 1] + previousRow.getValues()[i];
}

pascalRows[row - 1] = pascalRow;
previousRow = pascalRow;
}
}

public void print() {
for (PascalRow pascalRow : pascalRows) {
System.out.println(pascalRow.toString());
}
}
}

class PascalRow {

private int values[];

PascalRow(int row) {
this.values = new int[row];
}

int[] getValues() {
return values;
}

@Override
public String toString() {
final StringBuffer sb = new StringBuffer("PascalRow{");
sb.append("values=");
if (values == null) sb.append("null");
else {
sb.append('[');
for (int i = 0; i < values.length; ++i)
sb.append(i == 0 ? "" : ", ").append(values[i]);
sb.append(']');
}
sb.append('}');
return sb.toString();
}
}```

App.java
```package biz.tugay.pt;

public class App {

public static void main(String[] args) {
final PascalTriangle pascalTriangle = new PascalTriangle(25);
pascalTriangle.print();
}
}```