how to do a linear searc in java

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;
}
Source

Also in Java: