private static void printInternal(int[][] matrix, int index, int length) {
        if(length <= 0) {
            return;
        }
        if(length == 1) {
            System.out.print(matrix[index][index]);
            return;
        }
        for(int i = index; i < index + length - 1; i++) {
            System.out.printf("%d, ", matrix[index][i]);
        }
        for(int i = index; i < index + length - 1; i++) {
            System.out.printf("%d, ", matrix[i][length + index - 1]);
        }
        for(int i = index + length - 1; i > index; i--) {
            System.out.printf("%d, ", matrix[length + index - 1][i]);
        }
        for(int i = index + length - 1; i > index; i--) {
            System.out.printf("%d, ", matrix[i][index]);
        }
        printInternal(matrix, index + 1, length - 2);
    }