More specifically. . .
One way to specify the task:
Write a method that returns the index of the first element of b that equals x. If x does not occur in b, return b.length.
Example: b = {1, 2, 8, 5, 2, 9} (so b.length = 6)
- If x is 1, return 0
- If x is 2, return 1
- If x is 5, return 3
- if x is 3, return 6