After converting an array of numbers of type int into a string using the Arrays.toString () method; The indexOf () method has stopped working. That is, when such code is executed, -1 is always displayed on the screen. How to fix it?
int n = 10; int[] mass = new int[n]; int a = 0, b = 10; //fill in the mass with random numbers for(int i=0; i < n; i ++){ mass[i] = a + (int)(Math.random()*b); } String str = Arrays.toString(mass); System.out.println(str.indexOf(mass[0]));