answer:
1. The first fault should be for(int i = x.length-1; i >0; i++) should be changed to i>=0
The second fault should be for (int i = 0; i < x.length; i++) should be changed to for (int i = x.length-1; i >=0; i--)
2. test: x =[]; y = 3
test: x=[]
3.test:x=[2,3,5]; y = 3
test: x =[]
4.test: x=[2];y=3
test: x=[1,1,0]