Refractoring a Multi-Dinmension array

Hi all,

Due to the time it takes to initialise the following array Code:

`public double[][][][][][][][][] ARRAY = new double[3][3][7][7][2][33][33][2][2];`

i am trying to change int into a one dimension array using the following accessors.

Code:

`public double[] ARRAY = new double[3841992];`

public void set_ARRAY(int sets_p1,int sets_p2,int games_p1,int games_p2,int server

,int total_games_p1,int total_games_p2,int win_lose_p1,int win_lose_p2,double value){

int index = (sets_p1 + 1) * (sets_p2 +1) * (games_p1 + 1) * (games_p2 + 1) * (server + 1)

* (total_games_p1 + 1) * (total_games_p2 + 1) * (win_lose_p1 + 1)

* (win_lose_p2 + 1);

this.ARRAY[index] = value;

}

public double get_ARRAY(int sets_p1,int sets_p2,int games_p1,int games_p2,int server

,int total_games_p1,int total_games_p2,int win_lose_p1,int win_lose_p2){

int index = (sets_p1 + 1) * (sets_p2 +1) * (games_p1 + 1) * (games_p2 + 1) * (server + 1)

* (total_games_p1 + 1) * (total_games_p2 + 1) * (win_lose_p1 + 1)

* (win_lose_p2 + 1);

return this.ARRAY[index ];

}

However when i switch from the original code to the new code the values returned are incorrect.

So can anybody see an error in my logic, or can anybody see an alternate method?

Please bear in mind that i am unable to change the size of the array or put a different structure in place as the code that assigns it values isn't mine (although i do have the source)

Thanks in advance