how can user search in java code example
Example: how to do a linear searc in java
public static int linear(int[] arr, int keyValue)
{
int pos = -1;
for (int i = 0; i < arr.length; i++)
{
if (arr[i] == keyValue)
{
pos = i;
break;
}
}
return pos;
}