```
public int jump(int[] nums) {
if(nums.length <= 1){
return 0;
}
int maxIndex = 0;
int[] jumpCounts = new int[nums.length];
jumpCounts[0] = 0;
for(int i = 0; i < nums.length - 1; i++){
int j = i + 1;
maxIndex = Math.max(i + nums[i], maxIndex);
while(j < nums.length && j <= maxIndex){
if(jumpCounts[j] == 0){
jumpCounts[j] = jumpCounts[i] + 1;
}
j++;
}
}
return jumpCounts[nums.length - 1];
}
```