I have the following program working. It takes an array of numbers and returns the index value of each number. However, what I want it to do is to get an integer from input from a user and return the index value of just that integer. If the integer is not in the array I want it to return -1.
I know I can get the user to enter input by using :
x = stdin.nextInt();
Scanner stdin = new Scanner (System.in);
int x = stdin.nextInt();
I don't know how to incorporate it to work in the following code:
import java.util.Scanner;
import java.lang.Math;
class Arrays {
public static void main (String [] args){
int A []= {56, 418, 93, 11, 444};
}
static int find (int [] A, int N){
for (int index = 0; index <A.length; index++){
return index;
}
return -1;
}
}