java - Possible Lossy conversion from long to int -


I want to enter a int and other long ex: 1 I'm 100,000,000, and now I want to make an array of 1000000000 size. And then on each index of array, store int well, ex: arr [100000000] = 4 .

When I'm trying to do this Netbeans shows me an error in this line:

  arr = new long [y + 1] `and` arr [J] = 0`   

"Long probable potential loss conversion" here is my code: -

  public Fixed zero master throws IOException (string [] args {BufferedReader s = new BufferedReader (New InputStreamReader (System.in)); String [] xe = s.readLine (). the division (""); Int x = integer.center (xe [0]); Long y = long.moreover (xi [1]); Long [] arr; Arr = new tall [y + 1]; For (long jm = 0; j and lt; = y; j ++) arr [j] = 4; The ARA Index is an integer in Java and the compiler will advise you.    

then the maximum array size (approx.) integer.mx_arran Is. For large arrays, you should use the arrialists.

To get around this mess and quick

  arr = new long [(int) y + 1];    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -