I wish to enter one int
and another long
ex: 1 and 1000000000, and now I wish to create an array of size 1000000000. And then at each index of arra
You cannot create an array with more than 2^31-1 entries, so you should use an int
value when you do so (the compiler is simply warning you that the size will be truncated from long
to int
). 1000000000 is small enough to fit into int
, so you basically have no reason to use long y
in order to store this value in the first place.
According to your description, the array itself is designated to store int
values, so it doesn't need to be an array of long
values.
In short, you can and should change every long
in your code to int
.