C graphics C graphics - 7 months ago 61
Java Question

Shortest way to cast a 2d int array into 2d double

I have a method which only gets

to which I would like to pass
, 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.