Answer:
public static void main()
{
Scanner console = new Scanner(System.in);
System.out.println("Enter in a value");
int a = console.nextInt();
int[] array = {1,2,3,4,5};
int a1 = search(array, a);
System.out.println(a1);
}
public static int search(int[] array, int value)
{
boolean okay = true;
int b = 0;
for(b = 0; b<=array.length-1; b++)
{
if(value==array[0])
{
okay=true;
}
else
{
okay = false;
}
}
if(okay = true)
{
return b;
}
else
{
return -1;
}
}
Step-by-step explanation: