public class Test3 { public static void main(String [] args) { int baseAddress = 0; int [][] a = new int [15][15]; for (int i = 0; i <= 14; ++i) for (int j = 0; j <= i; ++j) { int address = baseAddress + 4 * (14*i + j); int pageNumber = address / 64; System.out.printf("%d ", pageNumber); } System.out.printf("\n"); // You need another nested loop like the one above. } }