Procedure Specifications
static int findA (int [] a, int val) { for (int i = 0; i < a.length; i++) { if (a[i] == val) return i; } return a.length; } static int findB (int [] a, int val) { for (int i = a.length -1 ; i >= 0; i--) { if (a[i] == val) return i; } return -1; }
val
is either missing or appears
more than once.requires: val occurs in a effects: returns result such that a[result] = val
3 of 16