My job is to write a method named `findLastIndex`, this method receives an array and an integer value representing an element of the array. `findLastIndex` searches through the array to find the given element and returns the index the last time this element is found in the array (the position of the element closest to the length of the array). In case the element is not found in the array, the method returns -1.

So my current code looks the following:

```
public static int findLastIndex(int [] nums, int element){
    for(int i = 0; i < nums.length; i++){
        if(i == element){
            return nums[i];
        }
    }
    return -1;
}

```

But I have no idea how to not return the first time , but to make it return the last times the element was found.