How to set value for the invocation count at runtime in Appium Java

Actually, I want to read the invocation count value from an excel file
I have tried this way, the int value from the excel file reading successfully

int x = ReadExcelNumber.readData(excelPath, "0", rowNo, "2");
@Test(invocationCount = x)

but while using it, it’s showing error like

Attribute value must be constant

any kind of help appreciated, thanks


    private Object[][] data = new Object[0][0];

    @DataProvider(name = "countProvider")
    public Object[][] createData() {
             // here some code to generate needed 5
             data = new Object[5][1];
        return data;
@Test(dataProvider = "countProvider")

Thanks @Aleksei for your answer, the value will be fixed, which I will read from the excel file, question updated

so just replace with:

data = new Object[ReadExcelNumber.readData(excelPath, "0", rowNo, "2")][1];

also similar ->