Program1:
1.fault: the i>0 should be i>=0 2.test: x=null 3.test: x=[2,3,5]; y=5; Expected=2; 4.test: x=[2,3,5]; y=4; Expected=-1;Program2:
1.fault: for(int i=0; i<x.length; i++) should be for(int i=x.length-1; i>=0; i--) 2.test: x=null 3.test: x=[0] Expected=0; 4.test: x=[0,3,5] Expected=0;