public static void main(String args[]) {
myMethod(); // i am calling static method from main()
}
.
public static ? myMethod(){
This can be one of the solution. But your present solution is good enough. You can also add new variables and still keep it clean, which cannot be done with present code.
private static final int INDEX_OF_STRING_PARAM = 0;
private static final int INDEX_OF_INT_PARAM = 1;
public static Object[] myMethod() {
Object[] values = new Object[2];
values[INDEX_OF_STRING_PARAM] = "value";
values[INDEX_OF_INT_PARAM] = 12;
return values;
}