0

Code:

 long Height ;
 long[][] results = new long[Height][Height];

Eclipse giving me an error But:

long[][] results = new long[(int) Height][(int) Height];

this is not. I want to have a range of long, So i want a long array

2 Answers2

8

The array will contains long values, but the array size accepts only ints

Marco Acierno
  • 14,682
  • 8
  • 43
  • 53
2

Array size should be state using an int. You can't use long for that. So the maximum 2D array that you can have is

long[][] results = new long[Integer.MAX_VALUE - 1][Integer.MAX_VALUE -1];

Integer.MAX_VALUE is 2147483647

So if you want to have more than that then it is better look for some other data structure