public boolean canJump(int[] A) {
int i=A.length-1;
while(i>0){
int j=0;
boolean hasNext=false;
for(j=0;j<i;j++){
if(A[j]+j>=i){
i=j;
hasNext=true;
break;
}
}
if(!hasNext)return false;
}
return true;
}