I have a method which only gets double[][]
to which I would like to pass int[][]
, is there a short way of doing this in java, something as simple as:
int [][] iArray = {
{ 1, 2, },
{ 5, 6, }
};
double [][] dArray = (double[][]) iArray ; ???
Unfortunately the only way to cast your array is to iterate through each element and cast them one by one while re-inserting in your new double[][]
array.
There is no shortcut.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With