I would like to initialize a float[][][]
object in Java. For instance,
float[][][] x = new float[1][2][3]
As you can see the integers 1, 2 and 3 are known by default. Now I have a int[]
defining these numbers ( dimensions ) of the array like,
int[] shape = { 1 , 64 , 64 , 3 }
From this array, how can I build an object like,
float[][][][] y = new float[1][64][64][3]
Note: The length of the shape
object is not predefined. Hence the dimensions of the resulting float[]
object will also vary.
How do we dynamically create a
float
matrix ( likefloat[][]
or evenfloat[][][]
) from a givenint[]
which defines its shape.