I don't know if it is a duplicate of Is it possible to dynamically build a multi-dimensional array in Java? because I don't know the
Array.newInstance(Array.class, 5);
method and I couldn't find an answer I understood on that question either but the 2 questions are definitely about the same topic
I want a multi-dimensional array to store the inputs and the inputs size is defined in the constructor like this
double[[]] inputs;
public AI(int[] inputSize) {
inputs = new double[inputSize];
}
I know the [[]] doesn't exist but is there an alternative?
(I tried to remove most of the context since I think the question will be more straightforward to answer this way)
EDIT : to be clear I don't want double[][] I want double[][][]... where the number of [] equals inputSize.size so for example : inputSize = {5,3,2,1}; => inputs = new double[5][3][2][1];